function Main(input){
	input = ""+input.split("\n")[0]*1;
  if(input[1]==input[2]){
  	if(input[0]==input[1] || input[2]==input[3]){
    	return "Yes"
    }
  }
  return "No"
}

console.log(Main(require("fs").readFileSync("/dev/stdin", "utf8")));