Pro.ID21644 TitleSubsequence Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21644 AC0 Submit0 Ratio- 时间&空间限制描述We say that a string A is a subsequence of another string B, if there is a number sequence C which satisfies the following conditions:
For example, "abed" is a subsequence of "aaaaaabbbed", while "abed" is not a subsequence of "aaaaacccdb". Of course any string is a subsequence of itself. In this problem, you are given a long string A, and many short strings Bi. You need to write a fast program which tells whether Bi is a subsequence of A. 输入On the first line of input, there is a positive integer T ≤ 20 specifying the number of test cases follow. The first line of each test case gives the string A. The second line contains an integer M ( 0 < M ≤ 10000 ), which is the number of short strings Bi. And the next following M lines each contain a string Bi. The length of A will be no more than 100,000 and the length of all Bi will be no more than 50. All the strings will have at least one letter, and all the letters will appear in lowercase. 输出Description We say that a string A is a subsequence of another string B, if there is a number sequence C which satisfies the following conditions:
For example, "abed" is a subsequence of "aaaaaabbbed", while "abed" is not a subsequence of "aaaaacccdb". Of course any string is a subsequence of itself. In this problem, you are given a long string A, and many short strings Bi. You need to write a fast program which tells whether Bi is a subsequence of A. Input On the first line of input, there is a positive integer T ≤ 20 specifying the number of test cases follow. The first line of each test case gives the string A. The second line contains an integer M ( 0 < M ≤ 10000 ), which is the number of short strings Bi. And the next following M lines each contain a string Bi. The length of A will be no more than 100,000 and the length of all Bi will be no more than 50. All the strings will have at least one letter, and all the letters will appear in lowercase. Output The output of each test case contains M+1 lines. The first line should be "Case X:" (quotes for clarity) where X is the number of the test case (starting at 1). Then M lines follow: for each Bi , if it's a subsequence of A output "Yes", otherwise output "No". Sample Input 2 Sample Output Case 1: Source 样例输入2 样例输出Case 1: 作者 |