#include<stdio.h>
#include<string.h>
void main()
{
	FILE *fin,*fout;
	char a[1000],b[1000];
	fin=fopen("ancient.in","r");
	fscanf(fin,"%s\n%s\n",a,b);
	fclose(fin);
	int leta[30]={0},letb[30]={0};
	int i,j,k,l,sum=0;
	for(i=0;i<strlen(a);i++)
		leta[a[i]-'A']++;
	for(i=0;i<strlen(b);i++)
		letb[b[i]-'A']++;
	sum=strlen(a)+strlen(b);
	for(i=0;i<26;i++)
		for(j=0;j<26;j++)
			if(leta[i]==letb[j])
			{
				sum-=(leta[i]+letb[j]);
				leta[i]=0;
				letb[j]=0;
			}
	fout=fopen("ancient.out","w");
	if(sum==0)
		fprintf(fout,"YES");
	else
		fprintf(fout,"NO");
	fclose(fout);
}