
fun main(args:Array<String>) {
    val ans = if(getAns(readLine()!!)) "YES" else "NO"
    println(ans)
}

fun getAns(txt:String):Boolean {
    if(txt.length <= 1) {
        return true
    }
    val distinct = txt.toSet()
    if(txt.length <= 2) {
        if(distinct.size == 2) {
            return true
        }
    }
    if(distinct.size <= 2) {
        return false
    }
    val cnt = distinct.map { a->txt.count { it == a } }.sorted()
    if(cnt[2] - cnt[0] <= 1) {
        return true
    }
    return false
}