提交时间:2020-01-01 19:54:57
运行 ID: 4275
#include<iostream> using namespace std; int main(){ int n; char str[1001]; scanf("%d%*c",&n); for(int k=1;k<=n;k++){ gets(str); int i=0; while(str[i]){ while(str[i]==' ') printf("%c",str[i++]); int l=i; while(str[i]&&str[i]!=' ') i++; int r=i-1; while(l<=r) printf("%c",str[r--]); } cout<<endl; } }