#include
#include
#include
using namespace std;
int main()
{
char c[300],a[300];
int b,d=0;
int i,k,j,t,len;
cin>>b;
getchar();//将回车键拿掉
while(b--)
{
gets(c) ;
len=strlen(c);
for(i=0,j=0,t=0;i
{
if(c[i]!=' ')a[j++]=c[i];
else {
if(t>0)cout<<" ";
for(k=j-1;k>=0;k--)
{
cout<
}
j=0;t++;
}
if(i==len-1)
{
cout
for(k=j-1;k>=0;k--)
{
cout<<a[k];
}
cout<<endl;
}
}
}
return 0;
}
例如输入
3
olleh !dlrow
m'I morf .udh
I ekil .mca
输出
hello world!
I'm from hdu.
I like acm.