import sys
def check(S):
    stop = True
    if len(S) < 2:
        print(base_S_length - len(S))
        sys.exit()
    S_length = len(S) - 1
    for i in range(S_length):
        if (S[i] + S[i + 1]) == 1:
            S[i] = S[i + 1] = 2
            stop = False    
    if stop:
        print(base_S_length - len(S))
        sys.exit()
    S = [i for i in S if i != 2]
    check(S)

S = list(map(int, list(input())))
base_S_length = len(S)
check(S)