#include<iostream>
#include<string>
using namespace std;
void main()
{
int T;
while (cin>>T)
{
getchar();
for (int i = 0; i < T; i++)
{
string str;
getline(cin, str);
int end = 0,top = 0;
while (str[end] != ‘\0‘)
{
if (str[end]==‘ ‘)
{
for (int i = end-1; i >=top; i--)
{
cout << str[i];
}
top = end + 1;
}
end++;
}
if (str[end]==‘\0‘)
{
for (int i = end; i >=top-1; i--)
{
cout << str[i];
}
}
cout << endl;
}
}
}
时间: 2024-10-21 12:58:37