"use strict";

function main(arg) {
    const N = arg.split("\n")[0].split("").map(n=>parseInt(n));
    
    let previous;
    let cnt = 0;
    let flg;
    
    N.forEach(function(value) {
        if(value == previous) {
            cnt++;
            if(cnt >=2) console.log("Yes");
            flg = true;
            return;
        } else {
            cnt = 0;
        }
        previous = value;
    });
    
    if(!flg) console.log("No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));