program aaa
implicit none

integer :: one, two, three, four
integer :: a, b, c
character(4) :: s

read*, s

one=iachar(s(1:1))
two=iachar(s(2:2))
three=iachar(s(3:3))
four=iachar(s(4:4))

if(one==two.and.three==four) then
write(*,'(a3)') 'Yes'
else if(one==three.and.two==four) then
write(*,'(a3)') 'Yes'
else if(one==four.and.two==three) then
write(*,'(a3)') 'Yes'
else 
write(*,'(a2)') 'No'
end if
end program