S = list(input())
list = []
count =0
for i in range(0,len(S) - 1):
    if S[i + 1] == S[i]:
        list.append(True)
    else:
        list.append(False)
for i in range(0,len(S) - 3):
    if list[i] == 1:
        list[i + 1] = 2
        if list[i + 2] == 0:
            count+= 1
count = list.count(True) + list.count(False) + 1
print(count)