#include<fstream.h>
#include<string.h>


int main()
{
ifstream input("ancient.in");
ofstream output("ancient.out");

char *a=new char[101];
char *b=new char[101];
char *copya=new char[101];
char *copyb=new char[101];
int *dif=new int[101];

input>>a>>b;

int i,j;
int len=strlen(a);
bool con=true;
char hold;

for(i=0;i<=len;i++)copya[i]=a[i];


for(i=0;i<=len;i++)copyb[i]=b[i];

for(i=0;i<len-1;i++)for(j=0;j<len-i-1;j++)if(copya[j]>copya[j+1]){

	hold=copya[j];
	copya[j]=copya[j+1];
	copya[j+1]=hold;
}

for(i=0;i<len-1;i++)for(j=0;j<len-i-1;j++)if(copyb[j]>copyb[j+1]){

	hold=copyb[j];
	copyb[j]=copyb[j+1];
	copyb[j+1]=hold;
}


for(i=0;i<len;i++)dif[i]=copya[i]-copyb[i]; 


for(i=0;i<len;i++){

	hold=dif[i];

	for(j=0;j<len;j++){

		if(copya[j]==copya[i] && dif[i]!=dif[j]){con=false; break;}

		if(copya[j]!=copya[i] && dif[i]==dif[j]){con=false; break;}
	}

if(!con)break;
}


if(!con){con=true; for(i=0;i<len-1;i++)if(dif[i]!=dif[i+1]){con=false; break;}}

if(!con)output<<"NO\n";
else output<<"YES\n";

return 0;
}





