#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
// string a,b;
// while(cin>>a) b = a + ' ' + b;
// cout << b << endl;
string a[90],b;
int n = 1;
while(cin>>b)
{
a[n++] = b;
}
for(int i=n-1;i>=1;i--)
cout<<a[i]<<' ';
cout<<endl;
return 0;
}
使用string要么一开始的时候就倒置好,要么就是声明二维数组或者一个string数组,输入完成后进行输出