Given a long text t and n strings , you are asked to check for each of the strings if they are a substring of t.
π
Pro Tip
If you need to increase the probability that the two substrings are actually equal to each other using hashes, you might consider calculating several hashes using different prime numbers and different modulo numbers to make sure the hashes are actually equal.
This way, youβd compare a tuple of hashes to another tuple of hashes.
Input
The first line of the input contains the text t (1 β€ |t| β€ ).
The next line contains a single integer n (1 β€ n β€ ).
The next n lines contain strings (1 β€ || β€ min(50, |t|)).
Output
The program should print n lines. Each line should contain Yes if the corresponding string is a substring of t, and No otherwise.