tokenizing and counting words in a string