[c++] taking input of a string word by word