#P3167. [CQOI2014] 通配符匹配
[CQOI2014] 通配符匹配
Description
Almost all operating systems' command-line interfaces (CLI) support wildcard matching for filenames to help users. The two most common wildcards are: an asterisk (*), which matches any sequence of characters of length 0 or more; and a question mark (?), which matches exactly one arbitrary character. You are to write a program that, given a list of filenames and a pattern string containing wildcards, determines which files can be matched.
Input Format
The first line is a string consisting of lowercase letters and the above wildcards. The second line contains an integer , indicating the number of files. The next lines each contain a string consisting only of lowercase letters, representing the list of filenames.
Output Format
Output lines, each being YES or NO, indicating whether the corresponding file can be matched by the pattern.
*aca?ctc
6
acaacatctc
acatctc
aacacatctc
aggggcaacacctc
aggggcaacatctc
aggggcaacctct
YES
YES
YES
YES
YES
NO
Hint
For of the testdata:
- String length does not exceed 100000.
- .
- The number of wildcards does not exceed 10.
Translated by ChatGPT 5
京公网安备 11011102002149号