#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <cassert>
//#include <vector>
#include <algorithm>

const int maxn = 200;

char S [2][maxn];
int C [2][256];

int main ()
{
	int i, j, k, a, b, c;

	freopen ("ancient.in", "rt", stdin);
	freopen ("ancient.out", "wt", stdout);
	
	memset (S, 0, sizeof (S));
	memset (C, 0, sizeof (C));

	scanf ("%s ", S [0]);
	scanf ("%s ", S [1]);

	a = strlen (S [0]);
	for (k = 0; k <= 1; k++)
		for (i = 0; i < a; i++)
			C [k][S [k][i]]++;

	for (k = 0; k <= 1; k++)
		std::sort (C [k], C [k] + 256);

	bool ans = true;
	for (i = 0; i < 256; i++)
		if (C [0][i] != C [1][i])
		{
			ans = false;
			break;
		}

	printf ("%s\n", (ans ? "YES" : "NO"));

	fclose (stdin);
	fclose (stdout);
	return 0;
}