#!/usr/bin/env python3
s = input()
n = len(s)
dp = [[0] * (n + 2) for _ in range(n)]
dp[0][1] = 1
dp[0][2] = 1
dp[1][2] = dp[0][1] + (s[0] != s[1])
dp[1][3] = dp[0][1] + 1
for i in range(2, n):
    for j in [1, 2]:
        for k in [1, 2]:
            now = s[i - k:i]
            nxt = s[i:i + j]
            dp[i][i + j] = max(dp[i][i + j], dp[i - k][i] + (now != nxt))
print(dp[n - 1][n])
