ZOJ Problem Set - 3198
In this problem, you are asked to get the element count of the intersection of two integer sets.
Standard input will contain multiple test cases. The first line of the input is a single integrate T (1 <= T <= 50) which is the number of test cases. T consecutive test cases followed. In each test case, there're several lines that contain the information of the two integer sets. The first line contains the element count S1 (1 <= S1 <= 100000) for set 1, followed by S1 lines, each line contains an integer in set 1. Then there's a line contains the element count S2 (1 <= S2 <= 100000) in set 2, and followed by S2 lines, each line contains an integer in set 2.
NOTE: there will be no duplicate elements in each sets and all the integers in each set will be sorted ascending.
For each test case in the input, there's only one line output that contains the element count of the intesection of the two sets.
1 5 1 2 3 4 5 6 2 3 4 5 6 7
Author: ZHOU, Ran
Source: ZOJ Monthly, May 2009