#include <fstream.h>
#include <string.h>

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

int main()
{
	int wc1[30];
	int wc2[30];

	char s1[150],s2[150];
	
	int i,j;
	for (i = 0; i<30; ++i )
	{
		wc1[i] = wc2[i] = 0;
	}

	char* p;

	in >> s1 >> s2;
	if (strlen(s1)!=strlen(s2))
	{
		out << "NO";
		return 0;
	}

	for ( p = s1; *p; ++p )
		++wc1[*p - 'A'];
	for ( p = s2; *p; ++p )
		++wc2[*p - 'A'];


	for ( i = 0; i<30; ++i )
		if (wc1[i]>0)
		{
			for ( j = 0; j<30; ++j )
				if (wc1[i]==wc2[j])
				{
					wc2[j] = 0;
					break;
				}
			if (j>=30)
			{
				out << "NO";
				return 0;
			}
		}

	out << "YES";

	return 0;
}