program taska;
{$APPTYPE CONSOLE}
{$I+,Q+,R+,O-}
uses
  SysUtils,Math;
type
  short=smallint;
  long=longint;
  ex=extended;
  bool=boolean;

var
  s,q:string[255];
  s1,s2:array[0..100]of long;
  a,b:array[char]of long;

var
  i:long;
  c:char;
begin
  assign(input,'ancient.in'); reset(input);
  assign(output,'ancient.out'); rewrite(output);

  readln(s);
  readln(q);
  fillchar(a,sizeof(a),0);
  b:=a;
  for i:=1 to length(s) do inc(a[s[i]]);
  for i:=1 to length(q) do inc(b[q[i]]);
  fillchar(s1,sizeof(s1),0);
  s2:=s1;
  for c:=#0 to #255 do inc(s1[a[c]]);
  for c:=#0 to #255 do inc(s2[b[c]]);
  i:=1;
  while (i<=100)and(s1[i]=s2[i]) do inc(i);
  if i>100 then
    writeln('YES') else
    writeln('NO');

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