# coding: utf-8
# Your code here!

S = input()

mystr = S[0]
mycnt = 0

for i in range(1,len(S)):
    if S[i] != mystr:
        mycnt += 1
        mystr = S[i]
        #print(i)
    else:
        continue
print(mycnt+2)