{$APPTYPE CONSOLE}
{$O-,Q+,R+}

uses Math, SysUtils;

type
  int = integer;
  bool = boolean;
  real = extended;


procedure sort( var cnt1 : array of int );
var
  s : string;
  ch : char;
  i : int;
  cnt0 : array[char] of int;
begin
  readln(s);
  s := trim(s);
  for ch := #0 to #255 do
    cnt0[ch] := 0;
  for i := 1 to length(s) do
    inc(cnt0[s[i]]);
  for i := 0 to 100 do
    cnt1[i] := 0;
  for ch := #0 to #255 do
    inc(cnt1[cnt0[ch]]);
end;

var
  cnta, cntb : array[0..100] of int;
  f : bool;
  i : int;
begin
  reset(input, 'ancient.in');
  rewrite(output, 'ancient.out');
  sort(cnta);
  sort(cntb);
  f := true;
  for i := 0 to 100 do
    f := f and (cnta[i] = cntb[i]);
  if f then
    writeln('YES')
  else
    writeln('NO')
end.
