프로그램 명: coci_vjeko
제한시간: 1 초
요약]
주어진 문자열과 매칭하는 문자열을 찾아야합니다.
* 에는 어떤 문자열이든 들어올 수 있습니다. (공백 문자열 포함)
예를들어 a*d는 abcd, ad, anestonestod 와는 매칭하지만 bcd와는 매칭하지 않습니다.
각 문자열에 대해 매칭하면 DA, 매칭하지 않으면 NE를 출력하세요.
In his spare time, Vjeko likes to browse through files in directories. Unfortunately, it seems to him that
the console on his computer broke down and now it doesn't correctly print file names that match a
certain pattern.
A pattern is string consisting of lowercase letters of the English alphabet and exactly one asterisk.
A file name matches a pattern if the pattern string can be made equal to the file name by replacing the
asterisk with an arbitrary string of lowercase letters of the English alphabet (an empty string
substitution is also possible). For example, strings “abcd”, “ad” and “anestonestod” all match the
pattern “a*d” and the string “bcd” does not.
Write a programme that will, given a pattern and file names, output whether a file name matches the
pattern or not.
INPUT
-
The first line of input contains the integer N (1 ≤ N ≤ 100), the number of files.
-
The second line of input contains a string of characters consisting of only lowercase letter of the
English alphabet and exactly one asterisk (ASCII value 42). The length of the string will not exceed 100
and the asterisk will not be located at the beginning nor at the end of the string.
-
Each of the following N lines contains file names, each in its own line. The file names consist of only
lowercase letters of the English alphabet and their length will not exceed 100.
OUTPUT
Output N lines. The i th line should be “DA” (Croatian for yes) if the i th file name matches the pattern
or “NE” (Croatian for no) if the i th file name does not match the pattern.
SAMPLE TESTS
input
3
a*d
abcd
anestonestod
facebook
output
DA
DA
NE
input
6
h*n
huhovdjestvarnomozedocisvastan
honijezakon
atila
je
bio
hun
output
DA
DA
NE
NE
NE
DA
출처:coci/2013-2014/contest6 1 번
요약:ladown21
[질/답]
[제출 현황]
[푼 후(2)]