program prob_a;

{$APPTYPE CONSOLE}

uses
  SysUtils;
label 1,2,3;
var
 fin,fout:textfile;
 i,s,k,j,f:integer;
 n:array[1..100] of char;
 s1,s2:string[100];
 c:array[1..26] of char;
 c1:char;
 b:array[1..100] of boolean;
 kod0,kodn:0..300;
function jilis(h:char;p:integer):char;
var kod,kd:0..300;
begin
 kod:=ord(h);
 if  kod+p>kodn then kd:=kod+p-kodn+kod0 else kd:=kod+p;
 jilis:=chr(kd);
end;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  assignfile(fin,'ancient.in');
  assignfile(fout,'ancient.out');
  reset(fin);rewrite(fout);
  readln(fin,s1);
  readln(fin,s2);
  if length(s1)<>length(s2) then goto 3;
  kod0:=ord('A');kodn:=kod0+25;
  for i:=0 to 25 do
   begin
    for f:=1 to length(s1) do
     b[f]:=false;
    s:=0;
    for j:=1 to length(s2)do
     begin
      n[j]:=jilis(s2[j],i);
      for k:=1 to length(s1) do
       if (n[j]=s1[k])and(not(b[k])) then begin
        b[k]:=true;s:=s+1;goto 1;
       end;
 1:
     end;
   if s=length(s1) then begin
     writeln(fout,'YES');
     goto 2;
    end;
   end;
3:  writeln(fout,'NO');
2:closefile(fin);closefile(fout);
end.
