program main
  implicit none
  character(4) S
  integer i,j,ans,x
  !read(*, *) (L(i), i = 1,N)
  read(*, *) S
  ans = 1
  do i = 1,4
    x = 0
    do j = 1,4
      if(S(i:i) == S(j:j)) then
        x = x + 1
      end if
      
    end do
    if(x < 2) then
      ans = 0
    end if
  end do
        
  if (ans == 0) then
    write(*, *) 'No'
  else
    write(*, *) 'Yes'
  end if
end program main
