s = raw_input()
N = len(s)
if N == 1:
    print(1)
    exit()
dp = [[0] * 3 for _ in xrange(N)]
dp[0][1] = 1
dp[1][2] = 0
dp[1][1] = 0 if s[1] == s[0] else 2
for i in xrange(2, N):
    if dp[i-1][2]:
        dp[i][1] = max(dp[i][1], dp[i - 1][2] + 1)
    if dp[i-1][1] and s[i] != s[i-1]:
        dp[i][1] = max(dp[i][1], dp[i - 1][1] + 1)
    if dp[i-2][1]:
        dp[i][2] = dp[i-2][1]+1
    if i >= 3 and (s[i-2-1]!=s[i-1] or s[i-2]!=s[i]) and dp[i-2][2]:
        dp[i][2] = max(dp[i][2], dp[i-2][2]+1)
print(max(dp[N-1][1], dp[N-1][2]))