提交时间:2019-12-27 21:04:22
运行 ID: 3936
#include<iostream> using namespace std; int main(){ int n; char a[1001]; scanf("%d",&n); for(int i=1;i<=n;i++){ gets(a); int k=0; while(a[k]!='\0'){ while(a[k]==' ') printf("%c",a[k++]); int w=k; while(a[k]&&a[k]!=' ') k++; int s=k-1; while(w<=s) printf("%c",a[s--]); } cout<<endl; } return 0; }