main :: IO()
main = do
    str <- getLine
    putStrLn $ if (getsolve str) then "Yes" else "No"
    
getsolve :: String -> Bool
getsolve str
    | str!!0 == str!!1 && str!!1 == str!!2      = True
    | str!!2 == str!!3 && str!!1 == str!!2      = True
    | otherwise                                 = False