character(4) :: s
logical :: flag = .false.
read*,s

if( s(1:1)==s(2:2)&&s(3:3)==s(4:4) ) flag = .true.
if( s(1:1)==s(3:3)&&s(2:2)==s(4:4) ) flag = .true.
if( s(1:1)==s(4:4)&&s(2:2)==s(4:4) ) flag = .true.

if( flag )then
  print*,'Yes'
else
  print*,'No'
end if
end program
