杭电acm——1062

#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main()
{
	int N;
	cin>>N;
	getchar();
	while(N--)
	{
		int m=0;
		string str;
		getline(cin,str);
		for(int i=0;i<str.length();i++)
		{
			if(str[i]==' ')
			{
				for(int j=i-1;j>=m;j--)
				{
					cout<<str[j];
				}
				cout<<" ";
				m=i+1;
			}
		}
		for(int j=str.length()-1;j>=m;j--)
		{
			cout<<str[j];
		}
		cout<<endl;
	}
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/AdventL/article/details/83178145