#include <stdio.h>
#include <stdlib.h>

int cmp( const void *a, const void *b )
{
	char *aa = (char *)a;
	char *bb = (char *)b;

	return (*aa)-(*bb);
}

int main( ){
	int mas[30], mas2[30];
	int i;
	char ch;

	freopen("ancient.in","rt",stdin);
	freopen("ancient.out","wt",stdout);

	for( i = 0; i < 30; i++ ){
		mas[i] = 0;
		mas2[i] = 0;
	}

	while( ( ch = getc(stdin) ) != '\n' ){
		mas[ch-'A']++;
	}

	while( ( ch = getc(stdin) ) != '\n' ){
		mas2[ch-'A']++;
	}

	qsort(mas,30,sizeof(mas[0]),cmp);
	qsort(mas2,30,sizeof(mas[0]),cmp);

	for( i = 0; i<30; i++ )
		if( mas[i] != mas2[i] ){
			printf("NO\n");
			return 0;
		}

	printf("YES\n");

	return 0;
}