問題一覧 > 通常問題

No.224 String Modification (easy)

レベル : / AI推定難易度 : 75 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 723
作問者 : drken1215
お気に入りにしたユーザー ProblemId : 609 / 自分の提出
問題文最終更新日: 2026-06-25 15:01:13
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 110 (順位表) の他の問題:

Problem Statement

You are given two strings \(S\), \(T\) of length \(n\). Each character of the strings is one of 'a'–'z'.
Now, we want to convert \(S\) into \(T\) by applying the following operation repeatedly.
Among all such sequences of operations, consider one with the fewest operations, and write a program that outputs that minimum number of operations.

(Operation)
Choose one character \(S\)[ i ] in \(S\), and change it to any character of your choice from 'a'–'z'.

Input

\(n\)
\(S\)
\(T\)

The first line contains an integer \(n\), the length of the strings \(S\), \(T\).
The following second and third lines contain the strings \(S\), \(T\), respectively.

\(1 \leq n \leq 1000\)
\(S\), \(T\) are strings consisting of 'a'–'z'.

Output

Output the answer on one line.

Sample

Sample 1
Input
7
aaabbcc
aabbccc
Output
2

First, changing the 3rd character as 'a' -> 'b' gives
aaabbcc -> aabbbcc
Next, changing the 6th character as 'b' -> 'c' gives
aabbbcc -> aabbccc

Sample 2
Input
5
abcde
abcde
Output
0

No operations are needed, so output 0.

Sample 3
Input
8
hidamari
yunocchi
Output
7

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。