program main
 implicit none
 character*4 s
 read(*,*) s
 if(s(1:1)==s(2:2) .and. s(3:3)==s(4:4) .and. s(2:2)/=s(3:3))then
  write(*,*) 'Yes'
 else if(s(1:1)==s(3:3) .and. s(2:2)==s(4:4) .and. s(2:2)/=s(3:3))then
  write(*,*) 'Yes'
 else if(s(1:1)==s(4:4) .and. s(2:2)==s(3:3) .and. s(2:2)/=s(4:4))then
  write(*,*) 'Yes'
 else
  write(*,*) 'No'
 end if
end program main