import Data.List

solve :: String -> Bool
solve [s] = True
solve [s1,s2] = s1 /= s2
solve s = abs (maximum g - minimum g) <= 1
  where
    g = map length . group . sort $ s

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