s = input()

ans = 0
bef = ""
for i in range(len(s)):
    if s[i] == bef:
        bef += s[i]
        continue
    else:
        bef = s[i]
        ans += 1
if len(bef) == 2:
    ans += 1

print(ans)
