#include using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 int main(void) { cin.tie(0); ios::sync_with_stdio(false); string S, T; cin >> S >> T; int cntS[26] = {}; int cntT[26] = {}; rep(i, S.length()) cntS[S[i] - 'a']++; rep(i, T.length()) cntT[T[i] - 'a']++; rep(i, 26) { //dump(cntS[i]); dump(cntT[i]); if (cntS[i] != cntT[i]) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }