A = input()
B=1
try:
    for i in range(len(A)):
        if A[0] != A[1]:
            B += 1
            A = A[1:]
        elif len(A)>3 and A[0] == A[1] and A[1] == A[2]:
            B += 2
            A = A[3:]
        elif len(A)<=3 and A[0] == A[1] and A[1] == A[2]:
            B += 1
            A = A[3:]
        else:
            B += 2
            A = A[3:]
except IndexError:
    print(B)