401489: GYM100482 I Searching

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Searchingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You have a simple system in which you want to have a search function. You decided to implement it for searching email addresses. There is a bunch of email addresses in your program.

User enters an email address. And the function detects if there is one. If yes, then its answer is “yes”, otherwise it tries to change one symbol in the entered address (the error detection). Then, if it matches only one address, the answer is still “yes”. But if it detects more than one address or does not detect anything, the answer is “no“.

Input

The first line contains the number of test cases T (T ≤ 100). The first line of each test case contains the number of email addresses in the program n and the number of queries m (1 ≤ n, m ≤ 10). The following n lines contain email addresses (only lowercase letters, digits and symbols “@”, “.”). The following m lines contain an email address, which is searched (only lowercase letters, digits and symbols “@”, “.”).

Note: the length of email addresses doesn’t exceed 100.

Output

For each test case output one line containing “Case #tc:”, where tc is the number of the test case (starting from 1). Then output m lines containing answers to the queries (“yes” or “no”).

ExamplesInput
1
3 4
terminator625@gmail.com
catman@yahoo.co.uk
catmug@yahoo.co.uk
terminator625@gmail.com
termonator625@gmail.com
terminator625@gmale.com
catmag@yahoo.co.uk
Output
Case #1:
yes
yes
no
no

加入题单

上一题 下一题 算法标签: