s = input()

tmp = s[0]
ans = 1
i = 1
while i < len(s):
    if tmp != s[i]:
        ans += 1
        tmp = s[i]
        i += 1
    elif i+2 < len(s):
        ans += 1
        tmp = s[i:i+2]
        i += 2
    else:
        break

s = s[::-1]
tmp = s[0]
ans2 = 1
i = 1
while i < len(s):
    if tmp != s[i]:
        ans2 += 1
        tmp = s[i]
        i += 1
    elif i+2 < len(s):
        ans2 += 1
        tmp = s[i:i+2]
        i += 2
    else:
        break

print(max(ans,ans2))
