Start: Dec, 04, 2016 12:00:00
杭州师范大学第十届程序设计竞赛—正式
End: Dec, 04, 2016 17:00:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 1ms
Memory: 1096kB
In contest: 1075

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int is(char s1[],char s2[],int n)
{
	int i;
	for(i=0;i<n;i++)
	{
		if(s1[i]!=s2[i])
			break;
	}
	if(i==n)
		return 1;
	else
		return 0;
}
void mp(char s1[],int a)
{
	int j,i,t;
	for(j=1;j<a;j++)
	{
		for(i=0;i<a-j;i++)
		{
			if(s1[i]>s1[i+1])
			{
				t=s1[i];
				s1[i]=s1[i+1];
				s1[i+1]=t;
			}
		}
	}
}
int main()
{
	int t;
	int a=0,b=0;
	scanf("%d",&t);
	char s1[10000]={'0'},s2[10000]={'0'};
	getchar();
	while(t--)
	{
		gets(s1);
		gets(s2);
		a=strlen(s1);
		b=strlen(s2);
		int i;
		for(i=0;i<a;i++)
		{
			if(s1[i]==' ')
				s1[i]=123;
		}
		for(i=0;i<b;i++)
		{
			if(s2[i]==' ')
				s2[i]=123;
		}
		mp(s1,a);
		mp(s2,b);
		int a1=0,b1=0;
		while(a--)
		{
			if(s1[a]!=123)
				break;
		}
		a1=a+1;
		while(b--)
		{
			if(s2[b]!=123)
				break;
		}
		b1=b+1;
		if(a1==b1)
		{
			if(is(s1,s2,a1))
				printf("Yes\n");
			else
				printf("No\n");
		}
		else
			printf("No\n");
	}
	return 0;
}