刷题学习C++代码(8)
句子逆序
http://www.nowcoder.com/questionTerminal/48b3cb4e3c694d9da5526e6255bb73c3
#include<bits/stdc++.h>
using namespace std;
int main() {
string str, res;
while(cin >> str) {
str += " " +res;
res = str;
}
res = res.substr(0, res.length() - 1);
cout << res << endl;
return 0;
}
查看10道真题和解析