{$APPTYPE CONSOLE}

uses SysUtils;

var sC,s:string;
    cc,lc:array['A'..'Z'] of integer;
    i:integer;
    c:char;

    cc1,lc1:array[0..239] of integer;

begin
 reset(input,'ancient.in');
 rewrite(output,'ancient.out');

 readln(sC);
 readln(s);
 sC:=trim(sC);
 s:=trim(s);

 for i:=1 to length(s) do inc(lc[s[i]]);
 for i:=1 to length(sC) do inc(cc[sC[i]]);

 fillchar(cc1,sizeof(cc1),0);
 fillchar(lc1,sizeof(lc1),0); 
 for c:='A' to 'Z' do inc(lc1[lc[c]]);
 for c:='A' to 'Z' do inc(cc1[cc[c]]);

 for i:=0 to 239 do
  if lc1[i]<>cc1[i] then begin writeln('NO'); halt(0); end;
 writeln('YES');
end.
