import collections
a=list(input())
c=collections.Counter(a)
t = sorted(list(c.values()))
if len(t)==3 and t[-1] - t[0] <= 1:print("YES")
elif len(t)==2 and t[-1] - t[0] == 0:print("YES")
else:print("NO")