s = input()
ss = set(s)
if len(ss) == 1:
  print('YES' if len(s) == 1 else 'NO')
elif len(ss) == 2:
  print('YES' if len(s) == 2 else 'NO')
else:
  counts = [s.count(c) for c in ss]
  print('YES' if max(counts) - min(counts) < 2 else 'NO')
  