import sys
INPUT = sys.stdin.readline
#入力関数
def SORO_INT(): return int(INPUT())
def MULT_INT_LIST(): return list(map(int, INPUT().split()))
def MULT_INT_MAP(): return map(int, INPUT().split())
def SORO_STRING(): return INPUT()
def MULT_STRING(): return INPUT().split()

S = SORO_STRING()
S = list(S)
P = len(S)
count=1

for i in range (len(S)):
    T = len(S)
    if S[i] == S[i+1]:
        if i+1 == T-1:
            SS = S[i]+S[i+1]
            S[i+1]=SS
            S.pop(i+1)
            
            break
        SS = S[i+1]+S[i+2]
        S[i+1]=SS
        S.pop(i+2)
        
        count=count+2
    else:
        count=count+1

    if count == P:
        break
print(len(S))