stringstream 简单应用
class Solution {
public:
string reverseWords(string s) {
stack<string> stk;
string res = "";
stringstream ss;
ss << s;
string input;
while(ss >> input){
stk.push(input);
}
while(!stk.empty()){
res += stk.top();
stk.pop();
if(!stk.empty())res += " ";
}
return res;
}
};