local mma = math.max
local s = io.read()
local n = #s
local a, b = {}, {}
for i = 1, n + 1 do a[i], b[i] = 0, 0 end
a[1] = 1
b[1] = 0
b[2] = 1
for i = 2, n do
  if s:sub(i - 1, i - 1) ~= s:sub(i, i) then
    a[i] = a[i - 1] + 1
  end
  a[i] = mma(a[i], b[i - 1] + 1)
  if 2 < i then
    b[i] = a[i - 2] + 1
    if 3 < i and s:sub(i - 3, i - 2) ~= s:sub(i - 1, i) then
      b[i] = mma(b[i], b[i - 2] + 1)
    end
  end
end
print(mma(a[n], b[n]))
