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

int main(){
    string A, B;
    cin >> A;
    cin >> B;
    char* astr = new char[A.size() +1 ];
    std::char_traits<char>::copy(astr, A.c_str(), A.size()+1);
    char* bstr = new char[B.size() +1 ];
    std::char_traits<char>::copy(bstr, B.c_str(), B.size()+1);
    sort(astr, astr+A.size());
    sort(bstr, bstr+B.size());
    A = astr;
    B = bstr;
    if(A==B){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}