#include #include using namespace std; int main() { string phrase{"This is a "}; string word; size_t position; size_t start{0}; position = phrase.find(' '); while(position != string::npos) { word = phrase.substr(start, position - start); if (word.size() != 0) { cout << '"' << word << '"' << endl; } start = position + 1; position = phrase.find(' ', position + 1); } word = phrase.substr(start, position - start); if (word.size() != 0) { cout << '"' << word << '"' << endl; } /* if(position == string::npos) { cout << "Not found " << endl; } else { cout <<"\"" << key << "\" is at position " << position << " in " << phrase << endl; } */ return 0; }