#include <fstream>
#include <string>

using namespace std;

ifstream fin("ancient.in");
ofstream fout("ancient.out");

int a[26];
int b[26]; 

int main()
{
	string first;
	string last; 
	int i,j; 
	int wrong = 0; 
	int found; 
	fin >> first; 
	fin >> last; 
	for (i = 0; i< first.length();i++)
	{
		a[first[i]-'A']++; 
		b[last[i]-'A']++; 
	}
	
	for (i = 0; i < 26; i++)
	{
		found = 0; 
		for (j = 0; j < 26; j++)
		{
			if (b[j] == a[i])
			{
				b[j] = 0; 
				found = 1; 
				break; 
			}
		}
		if (!found) wrong = 1; 
		if (wrong) break; 
	}
	if (wrong) fout << "NO\n"; 
	else fout << "YES\n"; 
	return 0; 
}