program A;
const alf: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var s,shif,s1:string;
 i,j,j1:integer;
   f:textfile;
Function Count(ch:char; st:string):byte;
Var
     K:byte;
Begin
     RESULT:=0;
     for K:=1 to length(st) do if ch=st[K] then INC(RESULT);
End;
begin

 assignfile(f,'ancient.in');
 reset(f);

 readln(f,shif);
 readln(f,s);
 closefile(f);
s1:='';
 for i:=1  to length(s) do
   for j:=1  to 26 do
     if s[i]=alf[j] then s1:=s1+alf[(j) mod 26 +1];

assignfile(f,'ancient.out');
 rewrite(f);
 J:=0;
for i :=1 to length(s1) do
begin
     //WRITELN(F,COUNT(S1[I],S1),' ',COUNT(S1[I],SHIF));
     if count(s1[i],s1)<>count(S1[i],shif) then J:=2;
end;
j1:=0;
FOR I:=1 TO LENGTH(S) DO
begin
     if count(s[i],s)<>count(s[i],shif) then j1:=3;
end;

 if ((J=0)or(j1=0))and(count(s1[i],s1)=count(s1[i],shif)) then
    writeln(f,'YES')
    else writeln(f,'NO');
 closefile(f);
end.
