Number of likes and dislikes

2.4

19 votes
Basic Programming, Easy
Problem

Your friend and you made a list of topics and both of them voted if they like or dislike the topic. They wrote 0 to denote dislike and 1 to denote like. They asked you to count the number of topics that both like or both dislike.

Input format

  • The first line contains a string, A, denoting Bob's likes and dislikes.
  • The second line contains a string, P, denoting Alice's likes and dislikes.

Output format

Print the number of topics both, Bob and Alice, like or dislike.

Constraints

1|A|,|P|105
|A|=|P|

  • Both A and P contains only 0 and 1. 0 denotes dislike and 1 denotes like.
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

A=010101
P=101101
They both like 4th and 6th topic and they both dislike 5th topic. So answer is 3.

Editor Image

?