code to tokenize input strings