from collections import deque
def main2():
    S = input()

    i = 0
    tmp = ""
    sub = deque()
    while True:
        j = 1
        while i + j <= len(S):
            if S[i:i+j] != tmp:
                sub.append(S[i:i+j])
                tmp = S[i:i+j]
                i = i + j
                # print(tmp)
                break
            else:
                j += 1

        if i + j > len(S):
            # print("over : {}".format(S[i:i+j]))
            if S[i:i+j] != "":
                sub.append(S[i:i+j])
            break

    if sub[-1] == sub[-2]:

        while True:
            a = sub.pop()
            b = sub.pop()

            if a + b != sub[-1]:
                sub.append(a+b)
                break
            else:
                sub.append(a+b)
    
    # print(sub)
    print(len(sub))

if __name__ == "__main__":
    main2()