import Data.List

solve :: String -> Bool
solve [s] = True
solve [s1,s2] = s1 /= s2
solve s = length g >= 3 && all ((l<=) . length) g
  where
    g = group . sort $ s
    l = length s `div` 3

main :: IO ()
main = do
    s <- getLine
    putStrLn $ if solve s then "YES" else "NO"