from collections import Counter
S = input()
ctr = Counter(S)

if len(ctr) == 1:
    print('YES' if len(S) == 1 else 'NO')
elif len(ctr) == 2:
    print('YES' if len(S) == 2 else 'NO')
else:
    mx = max(ctr.values())
    mn = min(ctr.values())
    print('YES' if mx-mn < 2 else 'NO')
