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

s = input().strip()

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

ans = 0
if len(s) == 1:
    print(ans)
    sys.exit(0)
for i in range(1, 3):
    ans = max(ans, dfs(s[:i], s[i:]))
print(ans)
