import numpy as np
s = input()
s+="?"
ind = 0
bef = ""
ans = 0
n = len(s)
while True:
    if s[ind] == "?":
        break
    if bef == s[ind]:
        bef = s[ind]+s[ind+1]
        ans += 1
        ind +=2
    else:
        bef = s[ind]
        ans += 1
        ind += 1
    if ind > n-1:
        break

# print(ans)

if s[-2] == s[-3]:
    ans -= 1

print(ans)

