class Solution {
public:
string reverseWords(string s) {
string res;
for(int i=s.size()-1;i>=0;i--)
{
if(s[i]!=' ')
{
int r=i;
while(i>=0 && s[i]!=' ') i--;
string t=s.substr(i+1,r-i);
res+=t; res+=" ";
}
}
res.pop_back();
return res;
}
};
10-29
254
11-02
440