import re

S = input()

count = 0

while '01' in S or '10' in S:
    #print(S)

    m = re.search('(00+)(11+)', S)
    #print(m)
    if m:
        if len(m.group(1)) > len(m.group(2)):
            num = len(m.group(2))
            S = re.sub('0{' + str(num) + '}1{' + str(num) + '}', '', S)
            count += num * 2
        else:
            num = len(m.group(1))
            S = re.sub('0{' + str(num) + '}1{' + str(num) + '}', '', S)
            count += num * 2
    m = re.search('(11+)(00+)', S)
    #print(m)
    #print(S)
    if m:
        # print('g0:' + m.group(1))
        # print('g1:' + m.group(2))
        if len(m.group(1)) > len(m.group(2)):
            num = len(m.group(2))
            S = re.sub('1{' + str(num) + '}0{' + str(num) + '}', '', S)
            count += num * 2
        else:
            num = len(m.group(1))
            S = re.sub('1{' + str(num) + '}0{' + str(num) + '}', '', S)
            count += num * 2

    #print(S)

    m = re.search('(01)+', S)
    # print(m)
    if m:
        num = len(m.group(1))
        S = re.sub('(01)+', '', S)
        count += num * 2
    m = re.search('(10)+', S)
    # print(m)
    if m:
        num = len(m.group(1))
        S = re.sub('(10)+', '', S)
        count += num * 2
    #print(S)



print(count)
