program a;

{$APPTYPE CONSOLE}

type
  Tcount = array['A'..'Z'] of Integer;

var
  S1, S2: String;
  C1, C2: TCount;

procedure CalcC(S:String; var C:TCount);
var
  I:Integer;
begin
  Fillchar(C, sizeof(C), 0);

  for I:=1 to Length(S) do
    Inc(C[S[I]]);
end;

function Equal: Boolean;
var
  I, J: Char;
  W: array['A'..'Z'] of Boolean;
  Found: Boolean;
begin
  Equal:=False;
  FillChar(W, sizeof(W), 0);
  for I:='A' to 'Z' do
    begin
      Found:=False;
      for J:='A' to 'Z' do
        if (W[J] = False) and (C2[J] = C1[I]) then
          begin
            W[J]:=True;
            Found:=True;
            Break;
          end;
      if not Found then
        Exit;
    end;
  Equal:=True;
end;

procedure run;
begin
  CalcC(S1, C1);
  CalcC(S2, C2);

  if (Equal) then
    WriteLn('YES')
  else
    WriteLn('NO');
end;

begin
  Assign(Input, 'ancient.in');
  Reset(Input);
  Assign(Output, 'ancient.out');
  ReWrite(Output);


  ReadLn(S1);
  ReadLn(S2);
  Run;
end.
