#include<iostream>
#include<string>
#include<memory.h>
using namespace std;
int alphabet1[26];
int alphabet2[26];
int main(int argc, char *argv[]){
string line1;
cin>>line1;
memset(alphabet1, 0, 26);
string line1Org="";
for(int i=0;i<line1.length();i++){
alphabet1[line1[i]-'A']++;
}
string line2;
cin>>line2;
memset(alphabet2, 0, 26);
for(int i=0; i<line2.length(); i++){
alphabet2[line2[i]-'A']++;
}
bool flag=true;
for(int i=0; i<26; i++){
if(alphabet1[i]!=0){
for(int j=0; j<26; j++){
if(alphabet1[i]==alphabet2[j]){
alphabet2[j]=-1;
break;
}else{
if(j==25){
flag=false;
break;
}
}
}
}
if(!flag){
break;
}
}
if(flag){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
return 0;
}
POJ-2159
最新推荐文章于 2017-04-20 22:03:20 发布