import sys

input = sys.stdin.readline



s = input().rstrip()



from collections import Counter



c = Counter(s)



if len(s) == 1:

    print("YES")

    sys.exit()



if len(list(c.keys())) == 1:

    print("NO")

    sys.exit()



values = list(c.values())

values.sort()



if len(list(c.keys())) == 2:

    if values[0] == 1 and values[1] == 1:

        print("YES")

    else:

        print("NO")

    sys.exit()



values[1] -= values[0]

values[2] -= values[0]



if values[1] == 1 and values[2] == 1:

    print("YES")

elif values[1] == 0 and values[2] == 1:

    print("YES")

elif values[1] == 1 and values[2] == 0:

    print("YES")

elif values[1] == 0 and values[2] == 0:

    print("YES")

else: 

    print("NO")

sys.exit()



import sys

input = lambda : sys.stdin.readline().rstrip()

mod = 10**9 + 7



s = eval(input())



from collections import Counter



c = Counter(s)



A = c["a"]

B = c["b"]

C = c["c"]



if len(list(c.keys())) == 1:

    if len(s) > 1:

        print("NO")

    else:

        print("YES")

    sys.exit()



if len(list(c.keys())) == 2:

    if A + B + C == 2:

        print("YES")

    else:

        print("NO")

    sys.exit()



A -= min(c.values())

B -= min(c.values())

C -= min(c.values())



if A >= 2 or B >= 2 or C >= 2:

    print("NO")

else:

    print("YES")
import sys

input = sys.stdin.readline
s = input().rstrip()
from collections import Counter

c = Counter(s)
if len(s) == 1:
    print("YES")
    sys.exit()
if len(list(c.keys())) == 1:
    print("NO")
    sys.exit()
values = list(c.values())
values.sort()
if len(list(c.keys())) == 2:
    if values[0] == 1 and values[1] == 1:
        print("YES")
    else:
        print("NO")
    sys.exit()
values[1] -= values[0]
values[2] -= values[0]
if values[1] == 1 and values[2] == 1:
    print("YES")
elif values[1] == 0 and values[2] == 1:
    print("YES")
elif values[1] == 1 and values[2] == 0:
    print("YES")
elif values[1] == 0 and values[2] == 0:
    print("YES")
else:
    print("NO")
sys.exit()

import sys

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7
s = eval(input())
from collections import Counter

c = Counter(s)
A = c["a"]
B = c["b"]
C = c["c"]
if len(list(c.keys())) == 1:
    if len(s) > 1:
        print("NO")
    else:
        print("YES")
    sys.exit()
if len(list(c.keys())) == 2:
    if A + B + C == 2:
        print("YES")
    else:
        print("NO")
    sys.exit()
A -= min(c.values())
B -= min(c.values())
C -= min(c.values())
if A >= 2 or B >= 2 or C >= 2:
    print("NO")
else:
    print("YES")

-input = sys.stdin.readline -s = input().rstrip() +input = lambda: sys.stdin.readline().rstrip() +mod = 10**9 + 7 +s = eval(input()) -if len(s) == 1: -    print("YES") +A = c["a"] +B = c["b"] +C = c["c"] +if len(list(c.keys())) == 1: +    if len(s) > 1: +        print("NO") +    else: +        print("YES") -if len(list(c.keys())) == 1: -    print("NO") -    sys.exit() -values = list(c.values()) -values.sort() -    if values[0] == 1 and values[1] == 1: +    if A + B + C == 2: -values[1] -= values[0] -values[2] -= values[0] -if values[1] == 1 and values[2] == 1: +A -= min(c.values()) +B -= min(c.values()) +C -= min(c.values()) +if A >= 2 or B >= 2 or C >= 2: +    print("NO") +else: -elif values[1] == 0 and values[2] == 1: -    print("YES") -elif values[1] == 1 and values[2] == 0: -    print("YES") -elif values[1] == 0 and values[2] == 0: -    print("YES") -else: -    print("NO") -sys.exit()