program fifty_fifty
  implicit none
  character(4) :: s
  integer :: a(26), i
  a = 0
  read(*,*) s
  do i = 1, 4
    a(ichar(s(i:i))-64) = a(ichar(s(i:i))-64)+1
  end do
  if (maxval(a).eq.2.and.minval(a,a.gt.0).eq.2) then
    write(*,'(a)') "Yes"
  else
    write(*,'(a)') "No"
  end if
  stop
end program fifty_fifty