from collections import Counter


def solve(s):
    freq = sorted(Counter(s).values())
    if sum(freq) == 1:
        return True
    if sum(freq) == 2:
        return freq[-1] == 1
    return len(freq) == 3 and freq[2] - freq[0] <= 1


print('YES' if solve(input()) else 'NO')
