401489: GYM100482 I Searching
Description
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“.
InputThe 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.
OutputFor 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”).
ExamplesInput1Output
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
Case #1:
yes
yes
no
no