S = input()
Slen = len(S)
S_inv = S[::-1]


prev_f = S[0]
ptr_f = 1
div_f = 0
while ptr_f < Slen:
    #print(prev_f)
    if len(prev_f) != 1 or prev_f != S[ptr_f:ptr_f+1]:
        prev_f = S[ptr_f]
        ptr_f += 1
    else:
        prev_f = S[ptr_f:ptr_f+2]
        ptr_f += 2
    div_f += 1

#print(div_f)


prev_i = S_inv[0]
ptr_i = 1
div_i = 0
while ptr_i < Slen:
    if len(prev_i) != 1 or prev_i != S[ptr_i:ptr_i+1]:
        prev_i = S[ptr_i]
        ptr_i += 1
    else:
        prev_i = S[ptr_i:ptr_i+2]
        ptr_i += 2
    div_i += 1

div_max = max(div_f, div_i)
print(div_max)