#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T; cin >> S >> T;
    sort(S.begin(),S.end());
    sort(T.begin(),T.end());
    cout << (S==T?"YES":"NO") << '\n';
}