import Data.List

solve :: String -> Bool
solve s
  | length s <= 2 && s == nub s = True
  | otherwise = (<=2) . length . group . sort $ s

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