#include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<string> v;
string s;
while (cin >> s) v.push(s);
cout << v.top();
v.pop();
while (!v.empty()) {
cout << " " << v.top();
v.pop();
}
return 0;
}
借鉴采用堆栈,先将输入单词存入栈底,输出栈顶单词