//
1.数组没初始化调了一下 还是直接输出数组
2.排序的时候元素没注意是26.
//
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
const int maxn = 100 + 5;
int main()
{
char str1[maxn], str2[maxn];
while(cin >> str1 >> str2)
{
int len1 = strlen(str1);
int len2 = strlen(str2);
int cnt1[maxn], cnt2[maxn];
memset(cnt1,0,sizeof(cnt1));
memset(cnt2,0,sizeof(cnt2));
for(int i = 0; i < len1; ++i) cnt1[str1[i] - 'A']++;
for(int i = 0; i < len2; ++i) cnt2[str2[i] - 'A']++;
sort(cnt1, cnt1+26);
sort(cnt2, cnt2+26);
bool ok = true;
for(int i = 0; i < 26; ++i)
{
if(cnt1[i] != cnt2[i])
{
ok = false; break;
}
}
if(ok) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}