program p_a_A;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  t,t1:boolean;
  s,s1:string;
  fin,fout:text;
  k,h:integer;
  b,b1:array ['A'..'Z'] of byte;
  c,c1:char;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  AssignFile(fin,'ancient.in');
  AssignFile(fout,'ancient.out');
  Reset(fin);
  Rewrite(fout);
  Readln(fin,s);
  Readln(fin,s1);
  t1:=true;
  For k:=1 to length(s) do
    begin
      inc(b[s[k]]);
      inc(b1[s1[k]]);
    end;
  For c:='A' to 'Z' do
    begin
      t:=true;
      For c1:='A' to 'Z' do
        begin
          if t then
            if b[c]=b1[c1] then
              begin
               b1[c1]:=0;
               t:=false;
              end;
        end;
    end;
  For c:='A' to 'Z' do
    begin
      if b1[c]<>0 then t1:=false;
    end;
  if t1 then writeln(fout,'YES')
       else writeln(fout,'NO');
  CloseFile(fin);
  CloseFile(fout);
end.
