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<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
	int t;
	char a[101],b[101];
	int len1,len2;
	scanf("%d",&t);
	getchar();
	while(t--)
	{
		gets(a);
		gets(b);
		len1=strlen(a);
		len2=strlen(b);

		int i,pass,temp;
		for(pass=1;pass<len1;pass++)
		{
			for(i=0;i<len1-pass;i++)
			{
				if(a[i]<a[i+1])
				{
					temp = a[i];
					a[i] = a[i+1];
					a[i+1] = temp;
				}
			}
		}

		for(pass=1;pass<len2;pass++)
		{
			for(i=0;i<len2-pass;i++)
			{
				if(b[i]<b[i+1])
				{
					temp = b[i];
					b[i] = b[i+1];
					b[i+1] = temp;
				}
			}
		}
		
		int x=0,y=0;
		for(int i =0;i<len1;i++)
		{
			if(a[i]!=' ')
				x++;
		}
		for(int i =0;i<len2;i++)
		{
			if(b[i]!=' ')
				y++;
		}
		
		if(x!=y)
			printf("No\n");
		else
		{
			
		  int sum=0;
		  for(int j=0;j<x;j++)
		  {
			  if(a[j]==b[j])
				 sum++;
		  }
		  if(sum==x)
			  printf("Yes\n");
		  else
			 printf("No\n");
		}			
	}
	return 0;
}