S = input()
N = len(S)
dp = [[0] * 2 for _ in range(N + 1)]

for i in range(N):
    s = S[i]
    if i != 0:
        if S[i-1] == s:
            if i != N-1:
                dp[i+1][1] = dp[i][0] + 1
            else:
                dp[i+1][1] = dp[i][0]
            dp[i+1][0] = dp[i][1]
        else:
            if i != N-1:
                dp[i+1][1] = dp[i][1] + 1
                dp[i+1][0] = dp[i][0] + 1
            else:
                dp[i+1][1] = dp[i][1]
                dp[i+1][0] = dp[i][0]
    else:
        dp[i+1][1] = 2
        dp[i+1][1] = 1
print(max(dp[N][0], dp[N][1]))
