#K34867. Hamming Distance or Length Difference

    ID: 25405 Type: Default 1000ms 256MiB

Hamming Distance or Length Difference

Hamming Distance or Length Difference

You are given two binary strings a and b.

If the strings have equal length, you must compute the Hamming distance between them, which is defined as

$$d(a,b)=\sum_{i=1}^{n}\mathbf{1}_{(a_i\neq b_i)}$$

where \(n\) is the length of the strings.

If the strings have different lengths, output the absolute difference in their lengths, i.e. $$|len(a)-len(b)|$$.

Read the input from standard input and write your output to standard output.

inputFormat

The input consists of exactly two lines read from standard input:

  • The first line contains the binary string a.
  • The second line contains the binary string b.

outputFormat

Output a single integer which is either the Hamming distance between a and b if they have the same length, or the absolute difference in their lengths if they are of different lengths.

## sample
1101
1011
2