program main
  implicit none
  integer i,N,ans,t,flag
  character(2*10**5) S
  read(*, *) S
  S = trim(S)
  N = len(trim(S))
  !read(*, *) (L(i), i = 1,N)
  ans = 1
  t = 2
  flag = 0
  do
    if (t == N .and. S(t:t) == S(t-1:t-1)) then
      t = t+1
    elseif (S(t:t) == S(t-1:t-1) .and. flag == 0) then
      t = t+2
      ans = ans + 1
      flag = 1
    else
      ans = ans + 1
      t = t + 1
      flag = 0
    endif
    if (t > N) then
      exit
    end if
  end do

  write(*, *) ans
end program main
