character s*4
read*, s
if(s(1:1)==s(2:2) .and. s(2:2)/=s(3:3) .and. s(3:3)==s(4:4)) then
	print*, "Yes"
else if(s(1:1)==s(3:3) .and. s(2:2)/=s(3:3) .and. s(2:2)==s(4:4)) then
	print*, "Yes"
else if(s(1:1)/=s(2:2) .and. s(2:2)==s(3:3) .and. s(1:1)==s(4:4)) then
	print*, "Yes"
else
	print*, "No"
end if
end