program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  f:text;
  s1,s2:string;
function func(s:string):integer;
var
  q,ip,jp,len:integer;
begin
  len:=length(s);
  for ip:=1 to len-1 do
    for jp:=ip+1 to len do
     if s[ip]<>' ' then
      if s[ip]=s[jp] then
        s[jp]:=' ';
  q:=0;
  for ip:=1 to len do
    if s[ip]<>' ' then inc(q);
  func:=q;
end;
begin
  assign(f,'ancient.in');
  reset(f);
  readln(f,s1);
  readln(f,s2);
  close(f);
  assign(f,'ancient.out');
  rewrite(f);
  if  func(s1)=func(s2) then writeln(f,'YES')
    else writeln(f,'NO');
  close(f);
end.
