import copy

S = list(input())
N = len(S)
ori_N = copy.copy(N)

count = 0
i = 0
while i < N-2:
    if S[i] == S[i+1] and S[i+2] == S[i+3]:
        S.pop(i+1)
        S[i+1] = '0'
        N -= 1
    i += 1
for i in range(N-1):
    if S[i] == S[i+1]:
        S[i+1] = '1'
        count += 1

print(N-count)
