from collections import Counter

s = eval(input())

dic = dict(Counter(s))

if len(dic)==1:

    for v in list(dic.values()):

        if v==1:

            print('YES')

        else:

            print('NO')

elif len(dic)==2:

    for v in list(dic.values()):

        if v>=2:

            print('NO')

            break

    else:

        print('YES')

else:

    a = dic['a']

    b = dic['b']

    c = dic['c']

    if a==b==c:

        print('YES')

    elif a==b and abs(b-c)<=1:

        print('YES')

    elif b==c and abs(c-a)<=1:

        print('YES')

    elif c==a and abs(a-b)<=1:

        print('YES')

    else:

        print('NO')
s = eval(input())

na = s.count('a')

nb = s.count('b')

nc = len(s) - na - nb

if max(na,nb,nc)-min(na,nb,nc)<=1:

    print('YES')

else:

    print('NO')
from collections import Counter

s = eval(input())
dic = dict(Counter(s))
if len(dic) == 1:
    for v in list(dic.values()):
        if v == 1:
            print("YES")
        else:
            print("NO")
elif len(dic) == 2:
    for v in list(dic.values()):
        if v >= 2:
            print("NO")
            break
    else:
        print("YES")
else:
    a = dic["a"]
    b = dic["b"]
    c = dic["c"]
    if a == b == c:
        print("YES")
    elif a == b and abs(b - c) <= 1:
        print("YES")
    elif b == c and abs(c - a) <= 1:
        print("YES")
    elif c == a and abs(a - b) <= 1:
        print("YES")
    else:
        print("NO")

s = eval(input())
na = s.count("a")
nb = s.count("b")
nc = len(s) - na - nb
if max(na, nb, nc) - min(na, nb, nc) <= 1:
    print("YES")
else:
    print("NO")

-from collections import Counter - -dic = dict(Counter(s)) -if len(dic) == 1: -    for v in list(dic.values()): -        if v == 1: -            print("YES") -        else: -            print("NO") -elif len(dic) == 2: -    for v in list(dic.values()): -        if v >= 2: -            print("NO") -            break -    else: -        print("YES") +na = s.count("a") +nb = s.count("b") +nc = len(s) - na - nb +if max(na, nb, nc) - min(na, nb, nc) <= 1: +    print("YES") -    a = dic["a"] -    b = dic["b"] -    c = dic["c"] -    if a == b == c: -        print("YES") -    elif a == b and abs(b - c) <= 1: -        print("YES") -    elif b == c and abs(c - a) <= 1: -        print("YES") -    elif c == a and abs(a - b) <= 1: -        print("YES") -    else: -        print("NO") +    print("NO")