#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int cnt1[26];
int cnt2[26];
int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
string a,b;
while(cin>>a>>b)
{
memset(cnt1,0,sizeof(cnt1));
memset(cnt2,0,sizeof(cnt2));
int len1=a.length();
int len2=b.length();
for(int i=0;i<len1;i++)
cnt1[a[i]-'A']++;
for(int i=0;i<len2;i++)
cnt2[b[i]-'A']++;
qsort(cnt1,26,sizeof(int),cmp);
qsort(cnt2,26,sizeof(int),cmp);
int flag=1;
for(int i=0;i<26;i++)
{
if(cnt1[i]!=cnt2[i])
flag=0;
}
if(flag)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}