Find Superwords (keteki)
All submissions for this problem are available.Given are a few words in an array. A superword is a combination of concatenation those words in that array, or even a single word in that array. A word can be used multiple times to create a superword. Given such a list of words, print "Yes" if its a superword, else print "No" for each word in that list. (Quotes for clarity).
Input will contain two integers separated by spaces on a new line. First integer N represents the number of words in the array, second integer T represents the words to be tested for superwords. The next line would contain N words separated by single spaces, on a new line.
It would be followed by T words each on a newline.
For each T words, print "Yes" or "No" depending on whether its a superword or not.
Note: Be careful of the case sensitivity of the output.
all words and superwords will be in lowercase
1<=number of words<=10
1<=number of superwords<=10
1<=length of each word<=5
1<=length of each superword<=100
aba can be made of a and ba. baba can be made of ba and ba. But it is not possible to make bbab, from the words in the array.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions