| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 (추가 시간 없음) | 1024 MB | 94 | 85 | 79 | 91.860% |
Dr. Orooji injured his right shoulder a few months ago and could type with only one hand for a while. For some reasons, Dr. O missed the space character (blank) often and two words would be next to each other without the space (i.e., words concatenated) and the spell-checker would complain.
Given the words in a dictionary and a word Dr. O has typed, determine the status of the typed word.
The first input line contains an integer, n (2 ≤ n ≤ 20), indicating the number of words in the dictionary. Each of the next n input lines contains a dictionary word. Each word starts in column 1, contains at least one lowercase letter, at most 20 lowercase letters, and no other characters. Assume that the dictionary words are unique, i.e., no duplicates.
The next input line contains an integer, m (1 ≤ m ≤ 100), indicating the number of words Dr. O has typed. Each of the next m input lines contains a typed word. Each typed word starts in column 1, contains at least one lowercase letter, at most 40 lowercase letters, and no other characters.
For each typed word, output one line as follows:
Note that if a typed word is in the dictionary and it is also a concatenation of two words in the dictionary, output should be 1.
7 this is a test th the e 12 is test isthis the th ee eee thee best istestis e ea
1 1 2 1 1 2 0 2 0 0 1 2