S=input()
result = 0
x = 0
a = '01'
b = '10'

def str_del(str,index):
    str = str[:index]+str[index+2:]
    return str

while 1:
    str1 = S[x]
    str2 = S[x+1]
    chk_str = str1 + str2
    if chk_str == a or chk_str == b:
        result += 1
        S = str_del(S, x)
        x = -1
    if (a not in S) and (b not in S):
        break
    x += 1

print(result)