S = input()
A = tuple(S)
N = len(A)
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[ind:ind + 1]
        ans += 1
        ind += 1
if N <= 2:

    if N == 1:
        ans = 1
    else:
        if A[0] == A[1]:
            ans = 1
        else:
            ans = 2
elif ind == N - 1:
    ans += 1

else:
    if pr == A[-2]:
        ans += 1
    elif A[-2] == A[-1]:
        ans += 1
    else:
        ans += 2
print(ans)