program main
character*4 :: s
integer :: x=0,i,j
 
read*, s
do i=1,4
do j=1,4
if(s(i:i) == s(j:j)) then
	x = x + 1
end if
end do
end do
if (x==8) then
print*, "Yes"
else 
print*, "No"
end if
 
end program main