华为机试:句子逆序
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main() {
// int a, b;
// while (cin >> a >> b) { // 注意 while 处理多个 case
// cout << a + b << endl;
// }
string str;
stack<string> s;
while(cin >> str)
{
s.push(str);
}
while(s.size() > 1)
{
cout << s.top() << " ";
s.pop();
}
cout << s.top() << endl;
s.pop();
}