# coding: utf-8
# Your code here!

s = input()
count = len(s)+1
flag=False
for i in range(len(s)-1):
    if(s[i]==s[i+1]):
        count=count-1
        flag=True
if(flag):
    print(count)
else:
    print(count-1)
    
    