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

#include<iostream>
#include<string>
#include<set>
#include<algorithm>
using namespace std;

int main(){
	int n;
	cin>>n;
	string nn;    getline(cin, nn);
	while(n--){
		string s1;
		string s2;
		
		getline(cin, s1);
		getline(cin, s2);
		
		sort(s1.begin(), s1.end());
		for(int i=0; i<s1.length(); ++i){ //去除所有空格 
			if(s1[0] == ' ')
				s1.erase(0,1);
		}
		
		sort(s2.begin(), s2.end());
		for(int i=0; i<s2.length(); ++i){ //去除所有空格 
			if(s2[0] == ' ')
				s2.erase(0,1);
		}
		
		
		
		if(s1.length() != s2.length()){
			cout<<"No"<<endl;
		}
		else {
			int flag = 1;
			for(int i=0; i<s1.length(); ++i){
				if(s1[i] != s2[i]){
					flag = 0;
					break;
				}
			}
			if(flag == 1){
				cout<<"Yes"<<endl;
			}
			else
				cout<<"No"<<endl;
		}
		
		

		
		
		
		
		/*
		string s1;
		getline(cin, s1);
		char ori[s1.length()];
		multiset<char>original(ori, ori+s1.length());
		
		string s2;
		getline(cin, s2);
		char cha[s2.length()];
		multiset<char>changed(cha, cha+s2.length());
		
		int flag = 1;
		set<char>::iterator pos1;
		set<char>::iterator pos2;
		for(pos1=original.begin(); pos1!=original.end(); ++pos1){
			for(pos2=changed.begin(); pos2!=changed.end(); ++pos2){
				cout<<*pos1<<*pos2;
				if(*pos1 != *pos2) {
					flag = 0;
					cout<<endl<<flag;
					break;
				}
			}
			if(flag = 0)	break;
		}
		if(flag == 1)	cout<<"YES"<<endl;
		else	cout<<"NO"<<endl;
		*/
	}
	return 0;	
}