All Submissions


One root. You might have seen that on the CSE 2k9 shirts.

Unix computers have one root directory - which might in turn have several directories contained inside of it,each with different names.

A directory is uniquely identified by its name and its parent directory (the directory it is directly contained in). This is usually encoded in a path,
which consists of several parts each preceded by a forward slash ('/').

For example:-

/home/seaweed/epicness

Breaking it down ,

epicness is contained in the seaweed directory
seaweed is contained in the home directory
home in contained whithin the root directory .


To the point now -

In order to create a directory, you use the mkdir command.You specify a path and then mkdir will create the directory described by that path(
but only if the parent directory already exists).

For example, if you wanted to create the "/home/seaweed/epicness" and "/home/seaweed/awesomeness"
directories from scratch, you would need four commands:


mkdir /home
mkdir /home/seaweed
mkdir /home/seaweed/epicness
mkdir /home/seaweed/awesomeness


Given the full set of directories already existing on your computer,and a set of new directories you want to create if they do not already exist-
How many MKDIR commands do you need to use ?


Input

The first line of the input gives the number of test cases, T.
Each case begins with a line containing two integers N and M.

The next N lines each give the paths of pre-existing directories.

The next M lines each give the path of the directories you want to create.

A path consists of one or more lower-case alpha-numeric strings
(i.e., strings containing only the symbols 'a'-'z' and '0'-'9') preceded by '/' .

Output

For each test case, output one line containing "Case #x: y",
where x is the case number and y is the number of mkdir you need.


Constraints

1 <= T <= 100.
0 <= N <= 100.
1 <= M <= 100.
Length of path <=100

Sample Input


3
0 2
/home/seaweed/epicness
/home/seaweed/awesomeness
2 1
/chicken
/chicken/egg
/chicken
1 3
/a
/a/b
/a/c
/b/b


Output


Case #1: 4
Case #2: 0
Case #3: 4


Problem Setter :- Kirti Vardhan Rathore

Languages: C#,JavaScript,Pascal,Perl,PHP,Python,Ruby

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0