Result: Accepted
Time: 1ms
Memory: 1704kB
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string.h>
#include<string>
using namespace std;
int main(){
int T,flag,t,j,m;
cin>>T;
t=T;
char a[101],b[101],c[201],d[201];
while(T--){
flag=1;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(c,0,sizeof(c));
memset(d,0,sizeof(d));
if(T==t-1)
getchar();
gets(a);
gets(b);
j=0;m=0;
for(int i=0;i<strlen(a);i++){
if(a[i]!=' '&&a[i]!='\n'){
c[j]=a[i];
j=j+1;
}
}
for(int i=0;i<strlen(b);i++){
if(b[i]!=' '&&b[i]!='\n'){
d[m]=b[i];
m=m+1;
}
}
sort(c,c+strlen(c));
sort(d,d+strlen(d));
if(strlen(c)==strlen(d)){
for(int i=0;i<strlen(d);i++){
if(c[i]!=d[i]){
flag=0;
break;
}
}
if(flag==1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
else
cout<<"No"<<endl;
}
return 0;
}