import re
s = input()
c = 0
flag = True

if flag:
    if "01" in s:
        c = s.count("01")
        re.sub("01","",s)
        
        if "10" in s:
            c += s.count("10")
            re.sub("10","",s)
        
        if "01" in s:
            c += s.count("01")
            re.sub("01","",s)
            
    if "10" in s:
        c = s.count("10")
        re.sub("10","",s)
        
        if "01" in s:
            c += s.count("01")
            re.sub("01","",s)
            
        if "10" in s:
            c += s.count("10")
            re.sub("10","",s)
    else:
        flag = False
            
print(c)