S = input()
init_count = len(S)

while len(S) > 1:
    no_01 = True
    before_s = S[0]
    for i, s in enumerate(S):
        if before_s != s:
            no_01 = False
            newS = S[:i-1] + S[i+1:]
            S = newS
            break
    if no_01:
        break
print(init_count - len(S))