substring with cancatenation of all words