Jackal and Bari have started solving problems in Online Judges. And in order to do well, they know that they should learn new algorithms and data structures.
Now it is time to form teams for the ICPC regional contest. And so, their coach wants to know how many algorithms they have learned so far.
As both are programmers, they have given the algorithms list in a text file. And as they know so many algorithms, some of the algorithms in their text files can be repeated mistakenly.
The first line of input contains T, The total number of test cases.
The next line contains two integers, n and m.
Next n lines contain the name of algorithms that Jackal knows. Then m lines follow, which contain the algorithms that Bari knows. The algorithm’s name is without any white-space.
Constraints:
T<=10
n<=1000
m<=1000
|A| <=20 ( here |A| is the length of the name of any algorithms )
For each test case, print the case number. Then output the algorithms that Jackal and Bari know. The first line of output should be the total number of algorithms that Jackal knows and next line is the total number of algorithms that Bari knows. You should count any algorithm only once for a person which are listed more than once. See sample input and output for details.
Input | Output |
---|---|
1 5 4 BFS DFS Prim’s DFS Dijkstra BFS Kruskal’s BellmenFord DFS | Case 1: Jackal 4 Bari 4 |
[N.B: DFS appears twice for Jackal, but it is considered only once for him. So, output for Jackal is 4]