program main
  implicit none

  integer
  character a,b,c,d

  read(*,*)a,b,c,d
  if ((a == b) .and.(c == d)) then
	write(*,*)"Yes"
  else if ((a == c) .and.(b == d)) then
	write(*,*)"Yes"
  else if ((a == d) .and.(b == c)) then
	write(*,*)"Yes"
  else if ((b == c) .and.(a == d)) then
	write(*,*)"Yes"
  else if ((b == d) .and.(a == c)) then
	write(*,*)"Yes"
  else if ((c == d) .and.(a == b)) then
	write(*,*)"Yes"
  else
	write(*,*)"No"
  end if

end program main