split given string into known words, using dymanic programming algorithm