program main
  implicit none
  character(len=100000) :: S
  character :: S1
  integer :: N,i,ic
  integer :: out
  read(*,*) S

  N=len(trim(S))
  S1=S(1:1)
  ic=1
  out=0
  do i = 2,N
     if (S1 == S(i:i)) then
        ic = ic+1
        cycle
     else
        out = out + ic/2
        S1=S(i:i)
        if (mod(ic,2) == 0) then
           ic = 2
        else
           ic = 1
        end if
     end if
  end do
  out = out + ic/2
  write(*,'(i0)') out
  stop
end program main