module Main where

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    n <- readLn :: IO Int
    let ans = filter ((>= 3) . length) . group $ show n
    if null ans
        then putStrLn "No"
        else putStrLn "Yes"