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