#include <bits/stdc++.h>

using namespace std;

int main()
{
  string A, B;
  cin >> A;
  cin >> B;
  sort(begin(A), end(A));
  sort(begin(B), end(B));
  if(A == B) cout << "YES" << endl;
  else cout << "NO" << endl;
}