Start: Jul, 13, 2019 11:00:00
计算机183班暑假练习
End: Sep, 01, 2019 12:00:00
Time elapsed:
Time remaining:

Judging Filling Problems 1866

Time Limit:  2 s      Memory Limit:   64 MB
Submission:0     AC:0     Score:0

Description

Yiyi is trying to develop an examine system. He finds it not so easy to judge filling question. There may be multiple answers for a blank, For example, The 2008 Olympic games was hold in ____CityThe answer can be “Beijing”, and it can also be “Peking”, he made the answer like this: Beijing(Peking), which means that Beijing, Peking are both correct answers; A filling question may have several blanks, For some problems those blanks should be answered in order, for example, The 2000, 2004 Olympic games was hold respectively in ____City and ____City, The answer should be “Sydney Athens”; For other problems those blanks don’t need be answered in order, for example, ACRush has taken part in the ICPC world finals in the year ____ and ____, The answer could be “2007|2009”, and it can also be “2009|2007”. Now you are required to help him to write a program to judge the filling problems.

Input

The first line contains an integer N, indicate the number of problems. The following N*3 lines, each 3 lines indicate a filling problem, the first line is the question, the second line is the answer(There will not be a answer contains ‘|’, ’(‘, ’)’ for every blank, For one problem every neighboring blanks are separated by “|” ), the third line indicate if the blanks should be filled in order, the word “True” means the blanks should be filled in order while “False” means that filling the blanks in order is not necessary. The following line contains an integer M, indicate the number of person, each person will fill all the problems, so there follows N*M lines, each N lines indicate a person’s answer for the N problems (There will not be a answer contains ‘|’, ‘(’, ‘)’ for every blank, For one problem every neighboring blanks are separated by “|” ), according to the sequence of the N problems.

Output

There are M lines, for each person, write the number of blanks he/she filled correctly.

Samples

input
3 The 2004, 2008 Olympic games was hold respectively in ____City and ____City. Athens|Beijing(Peking) True ACRush has taken part in the ICPC world finals in the year ____ and ____. 2007|2009 False Aaaa____bbbb_____. Ccc(cc)|Ddd(dd) False 2 Athens|Beijing 2007|2009 Dd|cc Beijing|Athens 2009|2008 Ddd|cc
output
5 3

Hint

For each question , any two of the blanks have different answers.