You are given a string S and Q query strings (q1, q2, ... , qQ). For each query string, report whether or not it is a subsequence of S.
Input :
The first line contains a string S.
The next line contains a single integer, Q.
The following Q lines each contain 1 query string qi.
Output :
Output Q lines. On the ith line print "Yes" (without quotes) if qi is a sub-sequence of S, otherwise print "No" (without quotes).
Constraints :
1 <= |S|, |q[i]|, Q <= 100,000
Sum of lengths of all query strings <= 1,000,000
All strings consist of lowercase english letters only. ('a'-'z')
hello 5 world lo elo hl ol
No Yes Yes Yes No
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor