from collections import Counter



S = eval(input())

c = Counter(S)



if len(c) == 3 and max(c.values()) - min(c.values()) <= 1:

    print("YES")

elif len(c) == 2 and len(S) == 2:

    print("YES")

elif len(c) == 1 and len(S) == 1:

    print("YES")

else:

    print("NO")

S = eval(input())

x = (S.count("a"), S.count("b"), S.count("c"))



if max(x) - min(x) >= 2:

    print("NO")

else:

    print("YES")

from collections import Counter

S = eval(input())
c = Counter(S)
if len(c) == 3 and max(c.values()) - min(c.values()) <= 1:
    print("YES")
elif len(c) == 2 and len(S) == 2:
    print("YES")
elif len(c) == 1 and len(S) == 1:
    print("YES")
else:
    print("NO")

S = eval(input())
x = (S.count("a"), S.count("b"), S.count("c"))
if max(x) - min(x) >= 2:
    print("NO")
else:
    print("YES")

-from collections import Counter - -c = Counter(S) -if len(c) == 3 and max(c.values()) - min(c.values()) <= 1: +x = (S.count("a"), S.count("b"), S.count("c")) +if max(x) - min(x) >= 2: +    print("NO") +else: -elif len(c) == 2 and len(S) == 2: -    print("YES") -elif len(c) == 1 and len(S) == 1: -    print("YES") -else: -    print("NO")