You are given a string s and a word list w which is a list of unique strings. Break the string into a sequence of words where each word is an element in w.
s: "workattech"
w: ["tech", "work", "problem", "at", "workattech"]
Result: ["work at tech", "workattech"]
s: "roundandround"
w: ["and", "round", "roundand"]
Result: ["round and round", "roundand round"]
Note:
' is smaller than 'a'.The first line contains an integer ‘T’, denoting the number of test cases.
For each test case the input has three lines:
For each test case, the output has the following lines:
2
workattech
5
tech work problem at workattech
roundandround
3
and round roundand
2
work at tech
workattech
2
round and round
roundand round
1 <= T <= 100
1 <= s length <= 50
1 <= w size <= 10
1 <= wi length <= 10