Problem Statement
Given an input string and a dictionary of words, find out if the input string can be segmented
into a space-separated sequence of dictionary words.
See following examples for more details. Consider the following dictionary
{ i, like, sam, sung, samsung, mobile, ice, cream, icecream, man, go, mango}
Input: ilike
Output: 1
The string can be segmented as "i like".
Input: ilikesamsung
Output: 1
The string can be segmented as "i like samsung" or "i like sam sung".
Example 1:
2
12
i like sam sung samsung mobile ice cream icecream man go mango
ilike
12
i like sam sung samsung mobile ice cream icecream man go mango
idontlike
>> 1
>> 0