#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string S, T; cin >> S >> T; vector cnts(26, 0), cntt(26, 0); for (char s : S) { cnts[s - 'a']++; } for (char t : T) { cntt[t - 'a']++; } if (cnts == cntt) { cout << "YES" << '\n'; } else { cout << "NO" << '\n'; } return 0; }