#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
typedef long long ll;
typedef pair<int, int> P;
typedef struct{
  int first;
  int second;
  int third;
}T;

//昇順
bool comp_Se(T& l, T& r){
  return l.second < r.second;
}

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