Result: Accepted
Time: 1ms
Memory: 1096kB
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
#define max(a,b) (a)>(b)?(a):(b)
int comp(const void*p,const void*q){
return(*(char*)q-*(char*)p);
}
int main(){
char str1[200],str2[200];
char temp1[200],temp2[200];
int i,t;
int tem1,tem2;
int flag=0;
scanf("%d",&t);
getchar();
while (t--){
gets(temp1);
gets(temp2);
flag=1;
qsort(temp1,strlen(temp1),sizeof(char),comp);
qsort(temp2,strlen(temp2),sizeof(char),comp);
for (i=0;i<strlen(temp1);i++){
if (temp1[i]==' '){
tem1=i;
break;
}
}
if (strncmp(temp1,temp2,tem1)==0)
printf("Yes\n");
else printf("No\n");
}
}