It really depends on the exact definition of 'word' in your requirements. For simple scenarios a
istringstream
is just enough:
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string str = "foo bar foobar";
istringstream iss(str);
string first_word;
iss >> first_word;
cout << "first word of '" << str << "' is '" << first_word << "'" << endl;
}