Result: Accepted
Time: 1ms
Memory: 1096kB
#include "stdio.h"
#include "string.h"
int main(){
int t,i,j,sum1,sum2,bl;
char a1[101],a2[101],b1[101],b2[101],m;
scanf("%d",&t);
getchar();
while(t--){
gets(a1);
gets(a2);
j=0;
sum1=0;
for(i=0;i<strlen(a1);++i){
if(a1[i]!=' ') {
b1[j]=a1[i];
++j;
++sum1;
}
}
j=0;
sum2=0;
for(i=0;i<strlen(a2);++i){
if(a2[i]!=' ') {
b2[j]=a2[i];
++j;
++sum2;
}
}
for(i=1;i<sum1;++i){
for(j=0;j<sum1-i;++j){
if(b1[j]>b1[j+1]){
m=b1[j];
b1[j]=b1[j+1];
b1[j+1]=m;
}
}
}
for(i=1;i<sum2;++i){
for(j=0;j<sum2-i;++j){
if(b2[j]>b2[j+1]){
m=b2[j];
b2[j]=b2[j+1];
b2[j+1]=m;
}
}
}
bl=1;
for(i=0;i<sum1||i<sum2;++i){
if(b1[i]!=b2[i]){
bl=0;
break;
}
}
if(bl==1) printf("Yes\n");
else printf("No\n");
}
return 0;
}