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