S = input()

divide_count = 0
previous_s = ''
skip_flag = False
s_len = len(S)
for i in range(s_len):
    if previous_s == S[i]: # 結合条件
        if s_len <= i + 3:
            previous_s = previous_s + previous_s
        elif S[i+1] == S[i+2]:
            skip_flag = True
            previous_s = S[i] + S[i+1]
            divide_count += 1
        else:
            previous_s = previous_s + previous_s
    else:
        divide_count += 1
        previous_s = S[i]
print(divide_count)