Hamming Distance
Time limit2sMemory limit1024 MB
Given two equal-length strings, count the positions where their characters differ.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
You are given an integer N and two strings S and T, each of length N. Print the Hamming distance between S and T.
The Hamming distance between S and T is the number of indices i (1 ≦ i ≦ N) where the i-th character of S differs from the i-th character of T.
Input
The input is given in the following format.
N
S
T
Output
Print the Hamming distance between S and T.
Print only the result. Do not print anything else, such as a prompt for input.
Constraints
1 ≦ N ≦ 100.Nis an integer.SandTare strings of lengthNconsisting of lowercase English letters.