One day the penguins of Madagascar found a string $S$... Wait... Wait. Actually the setter of the problem does not like long descriptions. So here is your problem:
You are given a string $S$ of length $N$ and some query $Q$. In each query, you are given a string $B$. You have to answer whether the string $B$ is a subsequence of $S$ 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 $B$ is a subsequence of $S$ or not in each query.
The first line contains an integer $N$ ($1 \le N \le 10^5$), the size of string $S$. The second line contains a string $S$, only lower case letter (‘a’-’z’) and the third line contains an integer $Q$ ($1 \le Q \le 10^5$), the number of queries.
Each of the next lines contains a string $B$ ($1 \le |B| \le 100$) to analyze.
For each query, print $\texttt{YES}$ if $B$ is a subsequence of $S$ or print $\texttt{NO}$.
Input | Output |
---|---|
16 helloonetwothree 5 hello one hren heeoe oneho | YES YES NO YES NO |