include iostream using namespace std int main cout Please enter string

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;
int main() {
cout << "Please enter a string (space as separator)" << endl;
string str;
int separator;
getline(cin, str);
for (separator = str.length() - 1; separator >= 0 && str[separator] != ' '; --separator);
cout << "Result" << endl << str.substr(separator + 1, str.length());
}