#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string a,b;
    cin >> a >> b;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    bool ok = true;
    for(int i=0; i<a.size(); i++){
        if(a.at(i) != b.at(i)){
            cout << "NO" << endl;
            ok = false;
            break;
        }
    }
    if(ok){
        cout << "YES" << endl;
    }
}