educative.io

So the parent strings have to be comprised only of the given words?

That is, if the words are [“cat”, “fox”], do the parent strings have to just be made up of those words, like “catcatcatfoxfoxcatfoxfoxcatfox” or can they be any string, like “afadfcdcatfoxfjifjkefoxcatkjfcatfoxlkf”?

Hi @Kevin7,
The parent string can be any string.

Like the example you suggested is “afadfcdcatfoxfjifjkefoxcatkjfcatfoxlkf”. With this input, the program will return [7,20,29], as it finds catfox at position 7, foxcat at 20 and cat,fox again at 29.