#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s,t; cin >> s >> t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	if(s==t){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
}