s = raw_input()
# s = "aabbaa"

# f = [0 for _ in range(len(s)+1)]

# for i in range(len(s)+1):
#     for j in range(i):
#         if s[2*j-i:j] == s[j:i]:
#             f[i] = max(f[i], f[j]+1-f[2*j-i])
#         else:
#             f[i] = max(f[i], f[j]+1)
# print f[-1]
def max_k_single_block(s):
    if len(s) % 3 == 0:
        return len(s)/3*2
    else:
        return len(s)/3*2+1

def max_k(s):
    f = [0 for _ in range(len(s))]
    f[0] = 1

    if s[0] == s[1]:
        f[1] = 1
    else:
        f[1] = 2

    if s[1] == s[2]:
        f[2] = f[0] + 1
    else:
        f[2] = f[1] + 1

    for i in range(3, len(s)):
        if s[i] == s[i-1]:
            f[i] = f[i-3] + 2
        else:
            f[i] = f[i-1] + 1

    # print f
    print f[-1]

# max_k("aabbaa")
# max_k("aaaccacabaababc")
max_k(s)