test :: Char -> [Char] -> Bool
test c cs = all (\x -> c == x) cs
        
solve :: String -> String
solve argList = if any [t1, t2, t3]
                then "Yes"
                else "no"
    where
        h = head argList
        l = last argList
        t1 = test h argList
        t2 = test h $ take 3 argList
        t3 = test l $ tail argList

main = do
    argList <- getStrLn
    putStrLn $ solve argList