#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
//const char* c[]={A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,S,Y,Z};
const char c[26]="ABCDEFGHIJKLMNOPQRSTUVWSYZ";
int main(void)
{ char a[200],b[200];
while(scanf("%s",a)!=EOF)
{int over=0,m;
scanf("%s",b);
m=sizeof(a);
sort(a,a+m);
sort(b,b+m);
int *p=lower_bound(c,c+26,a[0]);
int *d=lower_bound(c,c+26,b[0]);
int pd=*p-*d;
while(--m)
{*p=lower_bound(c,c+26,a[m]);
*d=lower_bound(c,c+26,b[m]);
int qd=*p-*d;
if(qd!=pd){over=1;break;}}
if(over)printf("NO\n");
else printf("YES\n");
}
return 0;
}