from collections import Counter
s = input()
if len(s) == 1:
  print("YES")
  exit()
t = sorted(Counter(s).values())
if len(s) == 2:
  if t == [1,1]:
    print("YES")
  else:
    print("NO")
elif len(t) == 3 and t[-1]-t[0]<2:
  print("YES")
else:
  print("NO")