program main
  implicit none
  integer CC, i, n, renzoku, CC2
  character(10**5) s, c
  read(*, *) s
  s = trim(s)
  n = len(s)
  CC = 0
  CC2 = 0
  if (n == 1) then
    write(*, '(i0)') CC
  else
    c = s(1:1)
    renzoku = 0
    do i = 2,n
      if (c == s(i:i)) then
        renzoku = renzoku + 1
      else
        if (CC2 == 0) then
           CC = CC + (renzoku+1)/2
           CC2 = 1
           c = s(i:i)
        else if (renzoku > 0) then
          if (mod(renzoku,2) == 0) then
            CC = CC + renzoku/2
            c = s(i:i)
            renzoku = 0
          else
            CC = CC + renzoku/2 + 2
            renzoku = 0
          end if
        endif
      endif
    end do
    if (renzoku > 0) then
      CC = CC + (renzoku+1)/2
    endif    
    write(*, '(i0)') CC
  end if
end program main