character(4) S
logical check
read*,S

check=.false.
if(S(1:1)==S(2:2))then
  if(S(3:3)==S(4:4).and.S(1:1)/=S(3:3))check=.true.
else if(S(1:1)==S(3:3))then
  if(S(2:2)==S(4:4).and.S(1:1)/=S(2:2))check=.true.
else if(S(1:1)==S(4:4))then
  if(S(2:2)==S(3:3).and.S(1:1)/=S(3:3))check=.true.
endif

print"(A)",merge("Yes"," No",check)

end