#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<algorithm> #include<sstream> using namespace std; int main() { int t,i,n,k; string s,ss,s1,s2; while(cin>>t) { while(t--) { cin>>n; getchar(); while(n--) { getline(cin,s); stringstream ss(s); i=0; k=s.size(); while(ss>>s2) { reverse(s2.begin(),s2.end()); for(;i<k;i++) { if(s[i]==‘ ‘) cout<<‘ ‘; else break; } while(s[i]!=‘ ‘&&i<k) i++; cout<<s2; } cout<<endl; } if(t) cout<<endl; } } return 0; }
zju 1151--------rwkj 1332 poj1519,布布扣,bubuko.com
zju 1151--------rwkj 1332 poj1519
原文:http://www.cnblogs.com/2014acm/p/3885963.html