import re

S = input()

count = 0

while '01' in S or '10' in 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)
    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

    if '01' in S:
        count += S.count('01') * 2
        S = S.replace('01', '')

        #print('count:' + str(count))
    if '10' in S:
        count += S.count('10') * 2
        S = S.replace('10', '')

        #print('count:' + str(count))



print(count)
