Hamming distance

In information theory, the Hamming distance between two strings of equal
length is the number of positions at which the corresponding symbols are
different. In another way, it measures the minimum number of
substitutions required to change one string into the other, or the
minimum number of errors that could have transformed one string into the
other.

Write a program that reads pairs of strings of the same length and
writes their Hamming distance.

Input

The input is made of n lines, and each line contains two words of the
same length. Each words is made of alfanumeric characters.

Output

For each line in the input, print the Hamming distance between its two
words.

Problem information

Author: Jordi Petit

Generation: 2026-01-25T11:28:28.875Z

© Jutge.org, 2006–2026.
https://jutge.org
