#include <iostream>
#include <stdio.h>
#include <string.h>
#define N 101

using namespace std;

char s[N];
char p[N];
int col_s[257];
int col_p[257];
int Scount[N];
int Pcount[N];
int count = 0;

int max()
{
	int maxS = 0, maxP = 0;
	for(int i = 1; i < N; i++)
	{
		if(Scount[i] > maxS) maxS = Scount[i];
		if(Pcount[i] > maxP) maxP = Pcount[i];
	}
	if(maxS >= maxP) return maxS;
	else return maxP;
}

int main()
{
	freopen("ancient.in","r",stdin);
	freopen("ancient.out","w",stdout);
	
	gets(s);
	gets(p);

	for(int i = 0; i <= 256;i++)
	{
		col_s[i] = 0;
		col_p[i] = 0;
		Scount[i] = 0;
		Pcount[i] = 0;

	}
	
	int len_s = char_traits <char>::length(s);
	int len_p = char_traits <char>::length(p);
	
	for(i = 0;i < len_s; i++)
	{
		if(s[i] != '\n' && s[i] != ' ') col_s[s[i]]++;
	}
	
	for(i = 0;i < len_p; i++)
	{
		if(p[i] != '\n' && p[i] != ' ') col_p[p[i]]++;
	}

	for(i = 0; i <= 256; i++)
	{
		if(col_s[i] != 0) Scount[col_s[i]]++;
		if(col_p[i] != 0) Pcount[col_p[i]]++;
	}
	
	int val = max();
	for(i = val; i > 0 ; i--)
	{
			if(Scount[i] == Pcount[i])
			{
				count++;
			}
	}

	if(val == count) printf("YES");
	else printf("NO");

	return 0;
}