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: 1700kB
In contest: 1075

#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	char s[101];
	char d[101];
	int i,n,s1,s2,wrong;
	cin>>n;
	getchar();
	while(n--){
		gets(s);
		gets(d);
		wrong=0;
	for(i=0;i<strlen(s);i++)
		for(int j=strlen(s)-1;j>i;j--)
			if(s[i]>s[j])
			{
				char temp=s[i];
				s[i]=s[j];
				s[j]=temp;
			}
			for(i=0;i<strlen(s);i++)
			{
				if(s[i]!=' '){s1=i;break;}
			}
			for(i=0;i<strlen(d);i++)
		for(int j=strlen(d)-1;j>i;j--)
			if(d[i]>d[j])
			{
				char temp=d[i];
				d[i]=d[j];
				d[j]=temp;
			}
			for(i=0;i<strlen(d);i++)
			{
				if(d[i]!=' '){s2=i;break;}
			}
			if((strlen(s)-s1)!=(strlen(d)-s2))wrong=1;
			for(i=0;;i++)
			{
				if(i==strlen(s)-s1)break;
				if(s[s1+i]!=d[s2+i]){wrong=1;break;}
			}
			if(wrong)cout<<"No"<<endl;
			else cout<<"Yes"<<endl;
	}
}