s = input()
d = {}
for i in s:
    d[i] = d.get(i,0)+1
flag = True
for i in d.values():
    if not(len(s)//3 <= i <= len(s)//3 + 1):
        flag =False
        break
if flag:
    print("YES")
else:
    print("NO")