Word Break Problem using Backtracking

Given a valid sentence without any spaces between the words and a dictionary of valid English words, find all possible ways to break the sentence in individual dictionary words. Example Consider the following dictionary { i, like, sam, sung, samsung, mobile, ice, cream, icecream, man, go, mango} Input: “ilikesamsungmobile” Output: i like sam sung mobile i like samsung mobile


what is wrong in this code?? i cant understand how to backtrack

can you please provide the exact link for the question

u r just finding the words from the given string
take an exmaple
i like likeman ->it is the dictionary
and striing = ilikeman
ur code first search i and get it next it will only search for like and man is not in the dictionary so ot will not seacrh it so it will return false
but ans is true
i am giving u a rough code check this