题解 | #句子逆序#
句子逆序
http://www.nowcoder.com/practice/48b3cb4e3c694d9da5526e6255bb73c3
C++
#include<iostream> #include<vector> #include<sstream> using namespace std; int main() { string str; getline(cin,str); istringstream is(str); string temp; vector<string> res; while(is>>temp) { res.push_back(temp); } for(int i = res.size()-1;i>=0;--i) { cout<<res[i]<<" "; } return 0; }