S = input()
A = tuple(S)
N = len(S)
ans = 1
ind = 1
pr = A[0:1]
while ind <= N - 3:
    if len(pr) == 2:
        pr = A[ind:ind + 1]
        ans += 1
        ind += 1
        continue
    if pr == A[ind:ind + 1]:
        pr = A[ind:ind + 2]
        ans += 1
        ind += 2
    else:
        pr = A[0:1]
        ans += 1
        ind += 1
if ind == N - 1:
    ans += 1
else:
    if pr == A[-2:]:
        ans += 1
    elif A[-2] == A[-1]:
        ans += 1
    else:
        ans += 2
print(ans)