#P1571. Counting Dual Award Winners
Counting Dual Award Winners
Counting Dual Award Winners
Miss Medusa, despite receiving the technology innovation award in Beijing, is not satisfied when she discovers that many of her peers have also won this award. Even more, some of them have additionally been awarded the special contribution award, which makes her increasingly envious. In order to measure her jealousy, she decides to count the number of people who have received both awards.
You are given two lists of names. The first list contains the winners of the technology innovation award and the second list contains the winners of the special contribution award. Your task is to determine the number of people who appear in both lists.
Input Format:
The first line contains two integers n and m separated by a space, where
- (n) is the number of technology innovation award winners,
- (m) is the number of special contribution award winners.
The next n lines each contain a name (a non-empty string) representing a winner of the technology innovation award. The following m lines each contain a name representing a winner of the special contribution award.
</p>Output Format:
Output a single integer: the number of people who have received both awards.
inputFormat
The input consists of multiple lines. The first line contains two integers \(n\) and \(m\) (separated by a space). The following \(n\) lines each contain a string representing a winner of the technology innovation award. The next \(m\) lines each contain a string representing a winner of the special contribution award.
outputFormat
Output a single integer that denotes the number of people who are present in both award lists.
sample
3 2
Alice
Bob
MissMedusa
Bob
Charlie
1