s = input()
dic = {}
for k in s:
    if k in dic:
        dic[k]+=1
    else:
        dic[k]=1

k = len(dic.keys())
if k==2:
    vs = dic.values()
    if sum(vs)==2:
        print('YES')
    else:
        print('NO')
elif k==3:
    vs = sorted(list(dic.values()))
    if vs[1]-vs[0]<2 and vs[2]-vs[1]<2 and vs[2]-vs[0]<2:
        print('YES')
    else:
        print('NO')
else:
    print('NO')