S = input()

count = 0

while len(S) != 0 or S != '11' or S != '00':
    #前から２つ組にして抜いて判定する
    new_S = ''
    for i in range(len(S)//2):
        judge = S[2*i:(2*i)+2]
        if judge != '10' and judge != '01':
            new_S += judge
        else:
            count += 2
    S = new_S

    if len(S) == 0 or S == '11' or S == '00':
        break
    else:
        #頭一つずらして２つ組にして判定する
        new_S = S[0]
        for i in range((len(S)-1)//2):
            judge = S[2*i+1:(2*i)+3]
            if judge != '10' and judge != '01':
                new_S += judge
            else:
                count += 2
        #len(S)が偶数の時は最後が抜けるから足してやる
        if len(S) % 2 == 0:
            new_S += S[-1]
        else:
            pass
        S = new_S

print(count)

