Start: Dec, 04, 2016 12:00:00
杭州师范大学第十届程序设计竞赛—正式
End: Dec, 04, 2016 17:00:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 1ms
Memory: 1096kB
In contest: 1075

#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");
	 }
	

	
	}