s = input()
N = len(s)
i = 0
count = 0

if N >= 3:
    while i < N-1:
        if i == 0:
            word = s[i]
            i += 1
            count += 1
            last = 1
        if last == 1:
            if s[i-1] != s[i]:
                word = s[i]
                i += 1
                count += 1
                last = 1
            elif i != N-2:
                word = s[i:i+2]
                i += 2
                count += 1
                last = 2
            else:
                i += 1
                last = 1
        else:
            word = s[i]
            i += 1
            count += 1
            last = 1
    if i+2 != N and ((last == 1 and word != s[N-1]) or last == 2):
        count += 1
if N == 2:
    if s[0] != s[1]:
        count = 2
    else:
        count = 1
if N == 1:
    count = 1

print(count)
