程序设计在线评测(Online Judge)


问题 1005. -- 字符串

1005: 字符串

时间限制: 1 Sec  内存限制: 128 MB
提交: 17  解决: 7
[提交][状态][讨论版]

题目描述

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.

 

输入

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.

输出

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

样例输入

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

样例输出

5
3

提示

来源

[提交][状态][讨论版]