1.
2.
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;
namespace wyx {
string reverseWords(const string& str) {
string reversedStr = str;
istringstream iss(reversedStr);
ostringstream oss;
string word;
while (iss >> word) {
reverse(word.begin(), word.end());
oss << word << " ";
}
return oss.str();
}
}
int main() {
string str = "Hello World";
string reversed = wyx::reverseWords(str);
cout << reversed <<endl;
return 0;
}