List Editing

All submissions for this problem are available.
At the ACME University, as part of the Graduate course work, each student is required to undergo project work. The authorities always make an effort to find a match among the students’ interests and the interests of the faculty members. First, they take a list of topics from the students' and a list of topics from the faculty. In order to avoid identifying students and faculties, all they preserve is simply, two consolidated lists of topics – one from the students and one from the faculties. No personal identification exists within these lists. The lists are sorted in ascending order of the indices of project topics in the repository. No topic appears twice in the same list.
To make the process simple, ACME University maintains a repository of 100 project topics  numbered from 1 to 100, inclusive. The students and faculty members must choose among those topics only. Their lists may have different number of topics; since more than one student (or faculty) may choose to work work on the same topic or some may like to work on multiple topics etc.
Once these two lists have been obtained, the university tries to make them identical. The student’s list is modified to match with the faculty’s list. The modification may be via
 inserting a new topic in the list
 deleting a topic from the list
 substituting a topic by another one
The university wants to do this with minimal number of modifications to the list as each modification needs one full day to be communicated and accepted by the students. It is assumed that the students do not disagree to any such modification.
Write a program that accepts the lists from students and faculties and computes the minimum number of modifications that will require to be made to make the student's list identical to the faculty's list.
Input
The input contains several test cases. The first line of the input contains the number T, the number of test cases. The first line in each test case contains the number M, the number of topics in the students' list. The second line contains M integers A_{1}, A_{2} .., A_{M} separated by single space characters. The third line in each test case contains the number N, the number of topics in the faculty's list. The fourth line contains N integers B_{1}, B_{2} .., B_{N} separated by single space characters.
Output
Output T numbers, each on a line by itself, without any leading spaces or zeros. The number should be the minimum number of modifications that can be made to the students' list to make it identical to the faculty's list, for each respective test case.
Constraints
1 ≤ T ≤ 100 1 ≤ M, N ≤ 100 1 ≤ A_{i}, B_{i} ≤ 100 The list { A_{1} .. A_{M} } has no duplicates. The list { A_{1} .. A_{M} } is sorted in ascending order. The list { B_{1} .. B_{N} } has no duplicates. The list { B_{1} .. B_{N} } is sorted in ascending order.
Sample Input
2 4 1 3 5 7 2 4 6 3 1 2 3 2 2 3
Sample Output
4 1
Explanation
In the first test case 1, 3, 5 and 7 should be deleted from the list and 4 and 6 should be inserted. But this can take 6 modifications. Instead, we can delete either two of the 4 topics from the students' list and substitute the remaining two by 4 and 6 respectively. This takes 4 modifications. 4 modifications is optimal for this test case.
Author:  admin 
Tester:  gamabunta 
Editorial  http://discuss.codechef.com/problems/EDITLIST 
Tags  acmkgp13, admin, dynamicprogramming, easy 
Date Added:  28102013 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, JAVA, GO 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions