import numpy as np

S = input()
N = len(S)

dp = np.full((N + 1, 3), 0)
dp[0][0] = 0

for i in range(N):
    for d_1 in range(1, 3):
        for d_2 in range(1, 3):
            a = i - d_1
            p = i + d_2

            print(S[a:i], S[i:p])

            if p >= N:
                continue
            elif a <= 0:
                dp[p][d_2] = max(dp[p][d_2], dp[i][d_1] + 1)
            elif S[a:i] != S[i:p]:
                dp[p][d_2] = max(dp[p][d_2], dp[i][d_1] + 1)

print(max(dp[N - 1][1], dp[N - 1][2]))

print(dp)
