Result: Accepted
Time: 1ms
Memory: 1096kB
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
int T,i,x[29],y[29],q,w;
char b[5000],c[5000];
scanf("%d",&T);
getchar();
while(T--){
for(i=1;i<=26;i++){x[i]=0;y[i]=0;}
gets(b);gets(c);
q=strlen(b);w=strlen(c);
for(i=0;i<q;i++){
if(b[i]=='a')x[1]+=1;
if(b[i]=='b')x[2]+=1;
if(b[i]=='c')x[3]+=1;
if(b[i]=='d')x[4]+=1;
if(b[i]=='e')x[5]+=1;
if(b[i]=='f')x[6]+=1;
if(b[i]=='g')x[7]+=1;
if(b[i]=='h')x[8]+=1;
if(b[i]=='i')x[9]+=1;
if(b[i]=='j')x[10]+=1;
if(b[i]=='k')x[11]+=1;
if(b[i]=='l')x[12]+=1;
if(b[i]=='m')x[13]+=1;
if(b[i]=='n')x[14]+=1;
if(b[i]=='o')x[15]+=1;
if(b[i]=='p')x[16]+=1;
if(b[i]=='q')x[17]+=1;
if(b[i]=='r')x[18]+=1;
if(b[i]=='s')x[19]+=1;
if(b[i]=='t')x[20]+=1;
if(b[i]=='u')x[21]+=1;
if(b[i]=='v')x[22]+=1;
if(b[i]=='w')x[23]+=1;
if(b[i]=='x')x[24]+=1;
if(b[i]=='y')x[25]+=1;
if(b[i]=='z')x[26]+=1;
}
for(i=0;i<w;i++){
if(c[i]=='a')y[1]+=1;
if(c[i]=='b')y[2]+=1;
if(c[i]=='c')y[3]+=1;
if(c[i]=='d')y[4]+=1;
if(c[i]=='e')y[5]+=1;
if(c[i]=='f')y[6]+=1;
if(c[i]=='g')y[7]+=1;
if(c[i]=='h')y[8]+=1;
if(c[i]=='i')y[9]+=1;
if(c[i]=='j')y[10]+=1;
if(c[i]=='k')y[11]+=1;
if(c[i]=='l')y[12]+=1;
if(c[i]=='m')y[13]+=1;
if(c[i]=='n')y[14]+=1;
if(c[i]=='o')y[15]+=1;
if(c[i]=='p')y[16]+=1;
if(c[i]=='q')y[17]+=1;
if(c[i]=='r')y[18]+=1;
if(c[i]=='s')y[19]+=1;
if(c[i]=='t')y[20]+=1;
if(c[i]=='u')y[21]+=1;
if(c[i]=='v')y[22]+=1;
if(c[i]=='w')y[23]+=1;
if(c[i]=='x')y[24]+=1;
if(c[i]=='y')y[25]+=1;
if(c[i]=='z')y[26]+=1;
}
int f=1;
for(i=1;i<=26;i++){
if(x[i]!=y[i]){f=0;printf("No\n");break;}
}
if(f==1)printf("Yes\n");
}
return 0;
}