add substring with concatenation of all words.java