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

s = input().strip()

import functools

@functools.lru_cache(maxsize=None)
def dfs(start, remain):
    if len(remain) == 0:
        return 1
    else:
        ans = 0
        for i in range(1, 3):
            if start == remain[:i]:
                continue
            else:
                ans = max(ans, 1 + dfs(remain[:i], remain[i:]))
        return ans

@functools.lru_cache(maxsize=None)
def _dfs(s):
    if len(s) <= 1:
        return len(s)
    if len(s) == 2:
        if s[0] == s[1]:
            return 1
        else:
            return 2
    if len(s) >= 3:
        if s[0] == s[1]:
            return max(1 + _dfs(s[2:]), 2 + _dfs(s[3:]))
        else:
            return max(1 + _dfs(s[1:]), 1 + _dfs(s[2:]))

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