find_first_of find_first_not_of f#include <iostream> #include <string> using namespace std; int main() { const string delims(" /t,.;"); string line; while (getline(cin, line)) { string::size_type begidx; string::size_type endidx; begidx = line.find_first_not_of(delims); while (begidx != string::npos) { endidx = line.find_first_of(delims, begidx); if (endidx == string::npos) { endidx = line.length(); } for (int i = endidx - 1; i >= static_cast<int>(begidx); --i) { cout << line[i]; } cout << ' '; begidx = line.find_first_not_of(delims, endidx); } cout << endl; } }