program Project1;

{$APPTYPE CONSOLE}

var s1,s2:string;
    a1,a2:array[1..26] of integer;
    i,j,n:integer;
    flag:boolean;
begin
   assign(input,'ancient.in');
   assign(output,'ancient.out');
   reset(input);
   rewrite(output);
   readln(s1);
   readln(s2);
   n:=length(s1);
   for i:=1 to n do begin
      inc(a1[ord(s1[i])-ord('A')+1]);
      inc(a2[ord(s2[i])-ord('A')+1]);
   end;
   i:=1;
   while i<=26 do begin
      if a1[i]<>0 then begin
        j:=1;
        while j<=26 do begin
           if (a2[j]<>0) and (a1[i]=a2[j]) then begin
              a2[j]:=0;
              break;
           end;
           inc(j);
        end;
      end;
      inc(i);
   end;
   flag:=false;
   for i:=1 to 26 do begin
      if a2[i]<>0 then begin
         flag:=true;
         break;
      end;
   end;

   if not flag then
      writeln('YES')
   else
      writeln('NO');

   close(input);
   close(output);
end.
