#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
string t;
cin >> t;
for (int i = 0; i < 16; i++)
{
string tmp = "";
vector<int> v(4);
for (size_t j = 0; j < s.length(); j++)
{
int shift = s[j] - 'A';
v[shift]++;
if (((v[shift] % 2) << shift) ^ ((1 << shift) & i))
tmp += s[j];
}
if (tmp == t)
{
cout << "Yes\n";
return 0;
}
}
cout << "No\n";
return 0;
}