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

s = input().strip()

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

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