# coding: utf-8

from collections import Counter

s = input().strip()
l = len(s)
c = Counter(s)
cs = [0, 0]
for i, (_, cnt) in enumerate(c.most_common(2)):
    cs[i] = cnt
if (cs[0] - 1 <= l - cs[0]) and (l - cs[0] - cs[1] >=  cs[0] - 1):
    print("YES")
else:
    print("NO")
