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>
int main(){
	int T;
	scanf("%d\n",&T);
	while(T--){
	char a[100],b[100];
	int c[100],d[100];
	gets(a);
	gets(b);
	int i,j;
	int l1=strlen(a);
	int l2=strlen(b);
	for(i=0;i<l1;i++){
	c[i]=a[i]-96;
	}
	for(j=0;j<l2;j++){
	d[j]=b[j]-96;
	}

	int pass,a1,temp;
	for(pass=1;pass<l1;++pass){
		for(a1=0;a1<l1-pass;++a1){
			if(c[a1]>c[a1+1]){
			temp=c[a1];
			c[a1]=c[a1+1];
			c[a1+1]=temp;
			}
		}
	}

		int pass2,a2,temp2;
	for(pass2=1;pass2<l2;++pass2){
		for(a2=0;a2<l2-pass2;++a2){
			if(d[a2]>d[a2+1]){
			temp2=d[a2];
			d[a2]=d[a2+1];
			d[a2+1]=temp2;
			}
		}
	}
	int m=0;
	int n=0;
	for(i=0;i<l1;i++){
	if(c[i]<0)
	m++;
	}

	for(j=0;j<l2;j++){
	if(d[j]<0)
	n++;
	}
	int t;
	int result;
	if(l1-m==l2-n){
		for(t=0;t<l1-m;t++){
			if(c[m+t]!=d[n+t]){
				result=0;
				break;
			}
			else
				result=1;
		}
		if(result==1)printf("Yes\n");
		else if(result==0) printf("No\n");
	}
	else 
		printf("No\n");
	}
return 0;
}