作业
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
namespace MySpace {
string str;
vector<string> words;
void split(const string &symbol);
void reverse_words();
}
void MySpace::reverse_words() {
for (auto &word: words) {
reverse(word.begin(), word.end());
word += " ";
}
string a;
a = accumulate(words.begin(), words.end(), a);
cout << a;
}
void MySpace::split(const string &symbol) {
size_t temp = 0, pos;
while (true) {
pos = str.find(symbol, temp);
if (pos == string::npos) break;
words.push_back(str.substr(temp, pos - temp));
temp = pos + symbol.length();
}
words.push_back(str.substr(temp, str.length()));
};
int main() {
getline(cin, MySpace::str, '\n');
MySpace::split(" ");
MySpace::reverse_words();
return 0;
}