program A;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var x,y:array['A'..'Z'] of integer;

procedure getData;
var c:char;
    i,k:integer;
begin
  for c:='A' to 'Z' do begin
    x[c]:=0; y[c]:=0;
  end;
  k:=0;
  read(c);
  while not((c>='A') and (c<='Z')) and not eof do read(c);
  if (c>='A') and (c<='Z') then begin
    inc(x[c]); inc(k);
  end;
  while ((c>='A') and (c<='Z')) and not eoln and not eof do begin
    read(c);
    inc(x[c]);
    inc(k);
  end;
  //second line
  if not eof then begin
    read(c);
    while not((c>='A') and (c<='Z')) do read(c);
    inc(y[c]);
    for i:=2 to k do begin
      read(c);
      inc(y[c]);
    end;
  end;
//  for c:='A' to 'Y' do begin
//    write(y[c],' ');
//  end;
//  writeln(k);
end;

procedure solve;
var i,j:char;
    k:integer;
    ch:boolean;
begin
  for i:='A' to 'Y' do begin
    for j:=chr(ord(i)+1) to 'Z' do begin
      if x[j]<x[chr(ord(j)-1)] then begin
        k:=x[j]; x[j]:=x[chr(ord(j)-1)]; x[chr(ord(j)-1)]:=k;
      end;
    end;
  end;
  for i:='A' to 'Y' do begin
    for j:=chr(ord(i)+1) to 'Z' do begin
      if y[j]<y[chr(ord(j)-1)] then begin
        k:=y[j]; y[j]:=y[chr(ord(j)-1)]; y[chr(ord(j)-1)]:=k;
      end;
    end;
  end;
{
  for i:='A' to 'Z' do begin
    write(x[i],' ');
  end;
  writeln;
  for i:='A' to 'Z' do begin
    write(y[i],' ');
  end;
}
  ch:=true;
  for i:='A' to 'Z' do begin
    if x[i]<>y[i] then ch:=false;
  end;
  if ch then writeln('YES') else writeln('NO');
end;

begin
  assign(input,'ancient.in'); reset(input);
  assign(output,'ancient.out'); rewrite(output);
  getData;
  solve;
  close(input); close(output);
end.
