代码如下:
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[110],sum;
void scand(int &num){
int f=1,x=0;
char c=getchar();
while(c=='-'){
f=-f,c=getchar();
}
while(c<'0' || c>'9'){
c=getchar();
}
while('0'<=c && c<='9'){
x=(x<<3)+(x<<1)+(c^48),c=getchar();
}
num=f*x;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
while(a[sum]!=0){
scand(a[++sum]);
}
for(int i=sum-1;i>=1;i--){
cout << a[i] << ' ';
}
return 0;
}