S = list(input())

ans = 1
length = 1
for i in range(0, len(S) - 1):
    if S[i] == S[i + 1] and i != len(S) - 2:
        length += 1
    else:
        if length == 2:
            ans += 1
            length = 1
        else:
            ans += length // 2 + 1
            length = 1

print(ans)
