#include <iostream>
#include <map>
#include <string>

int main() {
	std::string a,b;
	std::getline(std::cin,a);
	std::getline(std::cin,b);
	std::map<char,int> a_map,b_map;
	for(auto a_ch:a){
		a_map[a_ch]++;
	}
	for(auto b_ch:b){
		b_map[b_ch]++;
	}
	std::cout<<((a_map==b_map)?"YES":"NO")<<std::endl;
	// your code goes here
	return 0;
}