Yeonsu is running out of hard-disk space, so he wants to delete unnecessary files to free up room.
All files live in a single directory, and Yeonsu deletes them from that directory using the Linux rm command. The rm command can be used in the following two forms:
rm filename — deletes exactly the single file whose name is filename.rm string* — deletes, in one shot, every file whose name equals string or begins with string. The wildcard * may appear only at the very end of the string. (For example, you cannot write something like rm *.txt.) If string is empty, rm * deletes every file in the directory.You are given a set of files that must be deleted and a set of files that must never be deleted. Find the minimum number of rm commands needed to delete all of the files that must be deleted while deleting none of the files that must not be deleted.
The first line contains the number of test cases T. Each test case has the following format:
N1, the number of files that must be deleted (1 ≤ N1 ≤ 1000).N1 lines each contain one name of a file that must be deleted.N2, the number of files that must not be deleted (0 ≤ N2 ≤ 1000).N2 lines each contain one name of a file that must not be deleted.Every file name has length between 1 and 20 and consists only of uppercase and lowercase English letters, digits, and dots (.). Within a single test case, all file names are distinct.
For each test case, print the minimum required number of rm commands on its own line.
In the first test case, the files that must be deleted can be removed exactly using the following 8 commands:
rm BAPC.*, rm filt*, rm filename*, rm clean, rm cleanup.IN1, rm cleanup.IN2, rm cleanup.out, rm p*