#K81932. Binary String Similarity

    ID: 35863 Type: Default 1000ms 256MiB

Binary String Similarity

Binary String Similarity

Given two binary strings of equal length, your task is to compute their similarity. The similarity is defined as the number of positions where the two strings have the same character.

Mathematically, the similarity can be calculated using the formula:

$$ similarity = \sum_{i=1}^{n} I(b_{1_i} = b_{2_i}), $$

where \(I(\cdot)\) is the indicator function that equals 1 if the condition is true and 0 otherwise.

You are required to read the input from standard input (stdin) and output the result to standard output (stdout).

inputFormat

The input consists of three lines:

  • The first line contains an integer \(n\) indicating the length of the binary strings.
  • The second line contains the first binary string of length \(n\).
  • The third line contains the second binary string of length \(n\).

outputFormat

Output a single integer representing the similarity between the two binary strings.

## sample
5
11001
10011
3