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<math.h>
int main(){
	int t,i,j,k1,k2,len1,len2,l1,l2;
	char a[1002],b[1002],temp,a0[1002],b0[1002];
	scanf("%d",&t);
	getchar();
	while(t--){
		gets(a);
		gets(b);
		len1=strlen(a);
		len2=strlen(b);
		for(i=0;i<len1;i++){
			for(j=i+1;j<len1;j++){
				if(a[j]<a[i]){
					temp=a[j];
					a[j]=a[i];
					a[i]=temp;
				}
			}		
		}
		k1=0;
		for(i=0;i<len1;i++){
			if(a[i]!=' '){
				a0[k1]=a[i];
			    k1++;
			}
		}
	for(i=0;i<len2;i++){
			for(j=i+1;j<len2;j++){
				if(b[j]<b[i]){
					temp=b[j];
					b[j]=b[i];
					b[i]=temp;
				}
			}		
		}
		k2=0;
		for(i=0;i<len2;i++){
			if(b[i]!=' '){
				b0[k2]=b[i];
			    k2++;
			}
		}
		if(k1==k2){
			for(i=0;i<k1;i++){
				if(a0[i]!=b0[i])
					break;
			}
			if(i==k1)
				printf("Yes\n");
			else
			    printf("No\n");
		
		}
		else
			printf("No\n");
	
	}

	return 0;
}