import Control.Monad
import Control.Applicative
import System.IO
import Data.List

main :: IO ()
main = do
  x <- map length . group <$> getLine
  case x of
    [3,1] -> putStrLn "Yes"
    [1,3] -> putStrLn "Yes"
    [4] -> putStrLn "Yes"
    otherwise -> putStrLn "No"