QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23933. Hamming Distance

Statistics

Problem Statement

You are given an integer $N$ and $2$ strings $S, T$ of length $N$. Print the Hamming distance between $S$ and $T$.

Here, the Hamming distance between $S$ and $T$ is the number of indices $i$ ($1 \le i \le N$) such that the $i$-th character of $S$ and the $i$-th character of $T$ are different.

Constraints

  • $1 \le N \le 100$.
  • $N$ is an integer.
  • $S, T$ are strings of length $N$ consisting of lowercase English letters.

Input

The input is given in the following format:

N
S
T

Output

Print the Hamming distance between $S$ and $T$.

Do not print anything other than the result. (Do not print sentences prompting for input, etc.)

For the answer format, you may also refer to the practice problems and their sample solutions.

Sample 1

Sample Input 1

3
joi
ioi

Sample Output 1

1
  • The $1$-st characters of $S$ and $T$ are j and i, respectively, which are different.
  • The $2$-nd characters of $S$ and $T$ are o and o, respectively, which match.
  • The $3$-rd characters of $S$ and $T$ are i and i, respectively, which match.
  • Therefore, since the Hamming distance between joi and ioi is $1$, print $1$.

Sample 2

Sample Input 2

5
march
april

Sample Output 2

4
  • Since the Hamming distance between march and april is $4$, print $4$.

Sample 3

Sample Input 3

6
sample
sample

Sample Output 3

0
  • Since the Hamming distance between sample and sample is $0$, print $0$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.