import math
S = input()

ans = 0
pre = S[0]
n = 1
for i in range(1, len(S)):
    if pre == S[i]:
        n += 1
    elif n == 0:
        n += 1
        pre = S[i]
    elif n == 1:
        ans += 1
        n = 1
        pre = S[i]
    else:
        if i == len(S)-1:
            ans += math.ceil((n-1)/2.0) + 1
            n = 1
            pre = S[i]
        elif S[i] != S[i+1]:
            ans += math.ceil((n-1)/2.0) + 1
            n = 1
            pre = S[i]
        elif S[i] == S[i+1]:
            ans += math.ceil((n-1)/2.0) + 1
            n = 0
            pre = ""

ans += math.ceil(n/2.0)
print(ans)
