{$I-,Q-,R-,S-,D-,L-,O+}
{I+,Q+,R+,S+,D+,L+,O-}
program _A;
{$APPTYPE CONSOLE}
const
  inf = 'ancient.in';
  ouf = 'ancient.out';
  maxn = 102;

type
  int = longint;

var
  a, b : array ['A'..'Z'] of int;
  ch : char;
  i, n : int;
  l, k : char;
  issol : boolean;

begin
  assign(input, inf);
  reset(input);
  while not eoln do begin
    read(ch);
    if ch in ['A'..'Z'] then begin
      inc(n);
      inc(a[ch]);
    end;
  end;
  readln;
  for i := 1 to n do begin
    read(ch);
    inc(b[ch]);
  end;
  close(input);
  for l := 'A' to 'Z' do
    for k := succ(l) to 'Z' do
      if a[l] > a[k] then begin
        i := a[l];
        a[l] := a[k];
        a[k] := i;
      end;
  for l := 'A' to 'Z' do
    for k := succ(l) to 'Z' do
      if b[l] > b[k] then begin
        i := b[l];
        b[l] := b[k];
        b[k] := i;
      end;
  issol := true;
  for l := 'A' to 'Z' do
    if a[l] <> b[l] then begin
      issol := false;
      break;
    end;
  assign(output, ouf);
  rewrite(output);
  if issol then writeln('YES') else writeln('NO');
  close(output);
end.
