S = gets.to_s.split("")

eq = 1
arr = []
S.reduce("") { |a, s|
  if s == a
    eq += 1
  else
    arr << eq
    eq = 1
  end
  s
}
arr << eq
ans = 0
ans = arr.reduce(0) { |n, m| n = n + (m / 2)} 

check = false
arr.reduce(0) { |a ,b|
  nx = b
  if check && b == 1
    ans += 1
    nx = ""  
  end
  if a == 1 && b % 2 == 0
    check = true
  else
    check = false
  end
  nx
}

p ans
