program Project1;

var
  s1, s2, s0 : string;
  c1, c2 : array ['A'..'Z'] of Integer;

function GetResult : string;

  procedure Substitute;
  var
    i : Integer;
  begin
    FillChar(c2, SizeOf(c2), 0);
    for i := 1 to Length(s2) do
    begin
      if s2[i] = 'Z' then s2[i] := 'A'
      else Inc(s2[i]);
      Inc(c2[s2[i]]);
    end;
  end;

  function IsPermtation : Boolean;
  var
    c : Char;
  begin
    for c := 'A' to 'Z' do
      if c1[c] <> c2[c] then
      begin
        Result := False;
        Exit;
      end;
    Result := True;
  end;

var
  i, j : Integer;
 begin
  for i := 0 to 25 do
  begin
    if IsPermtation then
    begin
      Result := 'YES';
      Exit;
    end;
    Substitute;
  end;

  Result := 'NO';
end;

var
  i : Integer;
begin
  AssignFile(Input, 'ancient.in');
  Reset(Input);
  Readln(s1);
  Readln(s2);
  CloseFile(Input);

  for i := 1 to Length(s1) do
  begin
    Inc(c1[s1[i]]);
    Inc(c2[s2[i]]);
  end;

  AssignFile(Output, 'ancient.out');
  Rewrite(Output);
  Writeln(GetResult);
  CloseFile(Output);
end.
