tokenize function in cpp