Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`.  He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible.
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque


sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    s = list(input())
    result = [s.count("a"), s.count("b"), s.count("c")]
    tmp = min(result)
    for i in result:
        if i - tmp > 1:
            print("No")
            exit(0)

    print("Yes")


if __name__ == '__main__':
    main()

import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque


sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    s = list(input())
    result = [s.count("a"), s.count("b"), s.count("c")]
    tmp = min(result)
    for i in result:
        if i - tmp > 1:
            print("NO")
            exit(0)

    print("YES")


if __name__ == '__main__':
    main()
