#include <stdio.h>
#include <string.h>

	char c[250], p[250];
	int cc[26], pp[26];

int main(void)
{
	FILE * in = fopen("ancient.in", "rt");
	FILE * out = fopen("ancient.out", "wt");
	int i,j,l;

	fscanf(in, "%s", c);
	fscanf(in, "%s", p);

	l = strlen(c);
	for (i = 0; i < l; i++)
	{
		cc[c[i] - 'A']++;
		pp[p[i] - 'A']++;
	}

	for (i = 0; i < 26; i++)
	{
		for (j = 0; j < 26; j++)
		{
			if (cc[i] == pp[j] && cc[i] && pp[j]) 
			{
				cc[i] = pp[j] = 0;
				break;
			};
		}
	}

	l = 0;
	for (i = 0; i < 26; i++) l = l | cc[i] | pp[i];

	if (!l) fputs("YES", out); else fputs("NO", out);

	fcloseall();
	return 0;
}