import collections
import math

S = list(input())

count = dict(collections.Counter(S))
m = list(count.values())

if len(m) == 1 and len(S) == 1: # 文字1種類のとき
    print("YES")
elif len(m) == 1 and len(S) > 1:
    print("NO")
elif len(m) == 2 and len(S) == 2:
    print("YES")
elif len(m) == 2 and len(S) > 2:
    print("NO")
elif (max(m) - min(m)) <= 1:
    print("YES")
else:
    print("NO")
