A = input()
B=1
try:
    if (len(A) >5 and A[-1]==A[-2] and A[-2]==A[-3] and A[-3]!=A[-4] and A[-4]==A[-5] and A[-5]==A[-6]) or A[-1]!=A[-2] and A[-2]==A[-3] and A[-3]!=A[-4] and A[-4]==A[-5]:
        B -=1
        for i in range(len(A)):
            if A[0] != A[1]:
                B += 1
                A = A[1:]
                #print(A,'ifif')
            elif A[0] == A[1] and A[1] == A[2]:
                B += 2
                A = A[3:]
                #print(A,'ifelif')
            else:
                B += 2
                A = A[3:]
                #print(A,'ifelse')

    else:
        for i in range(len(A)):
            if A[0] != A[1]:
                B += 1
                A = A[1:]
                #print(A,'if')
            elif A[0] == A[1] and A[1] == A[2]:
                B += 2
                A = A[3:]
                #print(A,'elif')
            else:
                B += 2
                A = A[3:]
                #print(A)
except IndexError:
    print(B)