S = input()
count = 0
check = 0
for i in range(len(S)-1):
    # print(S[i])
    if S[i]==S[i+1]:
        if count>0:
            if I+2 == i:
                check+=1
        count+=1
        I = i
if (check+1)%2==0:
    diff=(check+1)//2
else:
    diff = check//2
# print(count)
# print(check)
print(len(S)-(count-diff))