program main
	implicit none
	character a*4
	integer j(4),i
	read(*,*)a
	do i=1,4
		read(a(i:i),*)j(i)
	enddo
	if((j(1)==j(2).and.j(1)==j(3)).or.(j(1)==j(3).and.j(3)==j(4)).or.&
	&(j(3)==j(2).and.j(4)==j(3)))then
		write(*,*)"Yes"
	else 
		write(*,*)"No"
	endif
end program main
