Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let judge a b c =
        let mx = max a (max b c) in
        let mi = min a (min b c) in
        print_endline @@ if mx - mi <= 1 then "YES" else "NO"
    in

    let rec loop i a b c =
        if i = n then judge a b c else
            match s.[i] with
            | 'a' -> loop (i + 1) (a + 1) b c
            | 'b' -> loop (i + 1) a (b + 1) c
            | 'c' -> loop (i + 1) a b (c + 1)
            | _ -> failwith "??"
    in
    loop 0 0 0 0
)