program AGC37_A
  character(200000)::S
  integer(8)::ans=1,N,i=1,L
  read(*,*)S
  N=len_trim(S)-1
  L=len_trim(S)
  do while(N>0)
     if(S(i:i)==S(i+1:i+1) .and. N>1) then
        N=N-2
        ans=ans+1
        i=i+2
        if(N/=2 .or. S(L-1:L-1)/=S(L:L)) then
           N=N-1
           ans=ans+1
           i=i+1
        else
           N=N-2
           ans=ans+1
           i=i+2
        end if
     else
        if(N/=2 .or. S(L-1:L-1)/=S(L:L)) then
           N=N-1
           ans=ans+1
           i=i+1
        else
           N=N-2
           ans=ans+1
           i=i+2
        end if
     end if
  end do
  write(*,*)ans
end program AGC37_A