No.224 String Modification (easy)
タグ : / 解いたユーザー数 723
作問者 :
drken1215
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もしくは右上の雲マークをクリックしてアカウントを作成してください。