Steward
分享是一種喜悅、更是一種幸福
程式語言 - LeetCode - C++ - 557. Reverse Words in a String III
題目:

解答:
class Solution {
public:
string reverseWords(string s) {
stringstream ss(s);
string w;
string ans;
while (ss >> w) {
reverse(w.begin(), w.end());
ans += w + " ";
}
ans.pop_back();
return ans;
}
};