Hamming distance P66313


Statement
 

pdf   zip

thehtml

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.

Public test cases
  • Input

    johny tommy
    10101 10001
    Marta Marta
    x y
    calbin hobbes
    

    Output

    3
    1
    0
    1
    5
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Official solutions
    C++ Java Python
    User solutions
    C++ Java Python