S = input()

divide_count = 0
previous_s = S[0]
count_same_s = 1
skip_flag = False
s_len = len(S)


def get_divide(s_len: int):
    if s_len <= 2:
        return 1
    two_divide = s_len//2 #4
    mod = s_len%2 #0
    for i in range(1,two_divide+1):
        if (3*i + mod -1) > two_divide:
            decide_num = i - 1
            break
    return (two_divide - decide_num) + (decide_num * 2) + mod 

for i in range(1, s_len):
    if skip_flag:
        skip_flag = False
        continue
    if previous_s == S[i]: # 結合条件
        count_same_s += 1
        continue
    else:
        if s_len <= i + 2:
            divide_count += get_divide(count_same_s)
        elif S[i] == S[i+1]:
            skip_flag = True
            if count_same_s > 2:
                divide_count += get_divide(count_same_s - 1)
            divide_count += 1 #ab的な結合
        else:
            divide_count += get_divide(count_same_s)
        '''
        if skip_flag:
            print(previous_s*count_same_s+S[i],get_divide(count_same_s - 1)+1)
        else:
            print(previous_s*count_same_s,get_divide(count_same_s))
        '''
        count_same_s = 1
        previous_s = S[i]
divide_count += get_divide(count_same_s)
#print(previous_s*count_same_s)       
print(divide_count)