import Control.Applicative

main :: IO ()
main = solve <$> getLine >>= putStrLn

solve :: String -> String
solve [c0, c1, c2, c3]
  | c0 == c1 && c1 == c2 = "Yes"
  | c1 == c2 && c2 == c3 = "Yes"
  | otherwise = "No"
