object Main {
  def main(args: Array[String]) {
    val str = io.StdIn.readLine()
    val s1 = str.take(3)
    val s2 = str.drop(1)
    def veri(s: String) = s.head == s(1) && s.head == s(2)
    println(if (veri(s1) || veri(s2)) "Yes" else "No")
  }
}