#include<bits/stdc++.h>
using namespace std;
int main(){
char a;
stack <char> s;
while(true){
while(true){
a=getchar();
if(a=='\n'||a==' ') break;
s.push(a);
}
while(!s.empty()){
cout<<s.top();
s.pop();
}
if(a==' ') cout<<" ";
if(a=='\n') break;
}
return 0;
}
//用栈处理字符串翻转
最新推荐文章于 2022-03-03 20:48:24 发布