You are given a string s and a word list w which is a list of unique strings. You have to determine if s can be broken down into a sequence of words where each word is an element in w.
s: “workattech”
w: [“tech”, “work”, “problem”, “at”]
Result: true
s: “roundandround”
w: [“and”, “round”]
Result: true
s: “helloworld”
w: [“hi”, “world”]
Result: false
The first line contains an integer ‘T’, denoting the number of test cases.
For each test case the input has three lines:
s.w.w.For each test case, a line containing 1 or 0 depending on whether the string s can be partitioned or not respectively..
3
workattech
4
tech work problem at
roundandround
2
and round
helloworld
2
hi world
1
1
0
1 <= T <= 100
1 <= s length <= 50
1 <= w size <= 10
1 <= wi length <= 10