import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = input().strip()

cache = {}
def dfs(index):
    if index in cache:
        return cache[index]
    target = s[index:]
    if len(target) <= 1:
        cache[index] = len(target)
        return cache[index]
    if len(target) == 2:
        if target[0] == target[1]:
            cache[index] = 1
            return cache[index]
        else:
            cache[index] = 2
            return cache[index]
    if len(target) >= 3:
        if target[0] == target[1]:
            cache[index] = max(1 + dfs(index + 2), 2 + dfs(index + 3))
            return cache[index]
        else:
            cache[index] = max(1 + dfs(index + 1), 1 + dfs(index + 2))
            return cache[index]

ans = 0
if len(s) == 1:
    print(ans)
    sys.exit(0)
print(dfs(0))
