import scala.io.StdIn

object Main extends App {
  
   val s = StdIn.readLine()
   println(
   if(s(0) == s(1) && s(1) == s(2)) "Yes"
   else if(s(1) == s(2) && s(2) == s(3)) "Yes"
   else "No"
   )
}