let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map(fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String


let s = readString();
let rec f str current num =
    if num >= 3 then 
        num
    else 
        match str with 
        | h::t -> if h = current then f t h num + 1 else f t h 0
        | _ -> 0

f (List.ofSeq s) (Seq.head s) 0
|> fun x -> if x >= 3 then "Yes" else "No"
|> printfn "%s"