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

char * zdvig(char * s, int n){
		int i = 0;
	while(int(s[i]) != 0)
	{
		if(int(s[i])-n < 65) s[i] = char(91-(65-(int(s[i])-3)));
		s[i]  = char(int(s[i])-n);

		i++;
	}

	return s;
}

int stugel(char * s){
char l;
int j=0;
int aa=0;
int i =0;
int c = 0;
int a[101];
while(int(s[i]) != 0){
c=0;
l = s[i];
j=0;	
while(int(s[j]) != 0){
	if (s[j] == l)  {c++;}
	j++;
}
a[i]=c;
aa=aa+a[i];
	i++;
}
return aa;

}

int main(){
	int poss=0;
	char s1[101];
	char s2[101];
	char *s;
	fstream f("ancient.in",ios::in);
	fstream fo("ancient.out",ios::out);
	f >> s1 >> s2;	
	for (int i = 0; i < 26;i++){
		s = zdvig(s1,i);
		if (stugel(s2) == stugel(s)) {poss = 1;break;}

	}
	if (poss == 1) {fo << "YES";}
	if (poss == 0) {fo << "NO";}
	return 0;
}