fun main(args: Array<String>) {
    cf17finalb()
}

fun cf17finalb() {
    val s = readLine()!!

    if (s.length == 1) return println("YES")

    if (s.length == 2) return println(if (s[0] == s[1]) "NO" else "YES")

    val grouped = s.groupBy { it }.map { it.value.size }

    if (grouped.size < 3) return println("NO")

    val (a, b, c) = grouped.sorted()

    val answer = when (s.length % 3) {
        0 -> a == b && b == c
        1 -> a == b && b + 1 == c
        else -> a + 1 == b && b == c
    }.let { if (it) "YES" else "NO" }

    println(answer)
}
