S = '_' + input()
### dp[i文字目][直前に見た文字] = 分割数
dp = []
for _ in range(len(S)):
    dp += [{}]
dp[1][S[1:2]] = 1
dp[2][S[1:3]] = 1
index = 1
while index < len(S):
    for k, v in dp[index].items():
        if index + 1 < len(S):
            s = S[index: index + 1]
            if s != k:
                if not s in dp[index + 1]:
                    dp[index + 1][s] = v + 1
                elif s in dp[index + 1] and dp[index + 1][s] < v + 1:
                    dp[index + 1][s] = v + 1
        if index + 2 < len(S):
            s = S[index: index + 2]
            if s != k:
                if not s in dp[index + 2]:
                    dp[index + 2][s] = v + 1
                elif s in dp[index + 2] and dp[index + 2][s] < v + 1:
                    dp[index + 2][s] = v + 1
    index += 1
# print(f'dp:{dp}', file=sys.stderr)
print(max([v for k, v in dp[-1].items()]))