from collections import Counter

s = list(eval(input()))



count = Counter(s)

if len(s) <= 3:

  if len(s) == 1: print("YES")

  elif len(list(count.keys())) == len(s): print("YES")

  else: print("NO")

else:

  if len(list(count.keys())) <= 2: print("NO")

  elif max(count.values()) - min(count.values()) <= 1: print("YES")

  else: print("NO")

s = eval(input())



a = s.count("a")

b = s.count("b")

c = s.count("c")



if abs(a-b) <=1 and abs(b-c) <= 1 and abs(c-a) <= 1: print("YES")

else: print("NO")
from collections import Counter

s = list(eval(input()))
count = Counter(s)
if len(s) <= 3:
    if len(s) == 1:
        print("YES")
    elif len(list(count.keys())) == len(s):
        print("YES")
    else:
        print("NO")
else:
    if len(list(count.keys())) <= 2:
        print("NO")
    elif max(count.values()) - min(count.values()) <= 1:
        print("YES")
    else:
        print("NO")

s = eval(input())
a = s.count("a")
b = s.count("b")
c = s.count("c")
if abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1:
    print("YES")
else:
    print("NO")

-from collections import Counter - -s = list(eval(input())) -count = Counter(s) -if len(s) <= 3: -    if len(s) == 1: -        print("YES") -    elif len(list(count.keys())) == len(s): -        print("YES") -    else: -        print("NO") +s = eval(input()) +a = s.count("a") +b = s.count("b") +c = s.count("c") +if abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1: +    print("YES") -    if len(list(count.keys())) <= 2: -        print("NO") -    elif max(count.values()) - min(count.values()) <= 1: -        print("YES") -    else: -        print("NO") +    print("NO")