s = list(input())
cnt = 0
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt += 1
if cnt > 0 and cnt % 2 == 0:
    print(len(s)-cnt+1)
elif  cnt > 0 and cnt % 2 != 0:
    print(len(s)-cnt)
else:
    print(len(s))