#include using namespace std; int main(){ string s; string w; cin >> s >> w; sort(s.begin(),s.end()); sort(w.begin(),w.end()); if(s == w)cout << "YES" << endl; else cout << "NO" << endl; return 0; }