One day the penguins of Madagascar found a string ... Wait... Wait. Actually the setter of the problem does not like long descriptions. So here is your problem:
You are given a string of length and some query . In each query, you are given a string . You have to answer whether the string is a subsequence of or not.
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. Subsequences for the word "apple" is “apl”, “ple”, “p” etc but “ael”, “alp” is not a subsequence of “apple”.
You have to find query is a subsequence of or not in each query.
The first line contains an integer (), the size of string . The second line contains a string , only lower case letter (‘a’-’z’) and the third line contains an integer (), the number of queries.
Each of the next lines contains a string () to analyze.
For each query, print if is a subsequence of or print .
Input | Output |
---|---|
16 helloonetwothree 5 hello one hren heeoe oneho | YES YES NO YES NO |