#C13182. Hamming Distance Calculation

    ID: 42692 Type: Default 1000ms 256MiB

Hamming Distance Calculation

Hamming Distance Calculation

This problem asks you to compute the Hamming distance between two strings of equal length. The Hamming distance is defined as the number of positions at which the corresponding symbols are different. Mathematically, for two strings \(s_1\) and \(s_2\) of length \(n\), the Hamming distance \(d_H(s_1, s_2)\) is defined by:

[ d_H(s_1, s_2) = \sum_{i=1}^{n} \delta(s_1[i], s_2[i]) \quad \text{with} \quad \delta(a, b) = \begin{cases} 0, & \text{if } a = b, \ 1, & \text{if } a \neq b. \end{cases} ]

You will be given two strings as input, and your task is to output the Hamming distance.

inputFormat

The input consists of two non-empty lines:

  • The first line contains the first string \(s_1\).
  • The second line contains the second string \(s_2\).

It is guaranteed that \(s_1\) and \(s_2\) have equal lengths.

outputFormat

Output a single integer representing the Hamming distance between the given strings. This integer should be printed to the standard output.

## sample
abcde
abcde
0