import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

S = input()

def g(i):
    if i == 0:
        return 0

    if i < 2:
        return 1

    if S[i] != S[i-1]:
        return g(i-1)+1

    return g(i-3)+2

print(g(len(S)-1))
