# -*- coding:utf-8 -*-



def solve():

    S = eval(input())



    ans = 0

    i = 0

    while i != len(S):

        if i+1 >= len(S):

            break



        if S[i] != S[i+1]:

            # 消す

            if i == 0:

                if len(S) <= 2:

                    ans += 1

                    S = ""

                    continue

                else:

                    ans += 1

                    S = S[2:]

                    continue

            else:

                if i+2 < len(S):

                    ans += 1

                    S = S[:i] + S[i+2:]

                    i -= 1

                    continue

                else:

                    ans += 1

                    S = S[:i]

                    i -= 1

                    continue

            

        i += 1

    print((ans*2))





if __name__ == "__main__":

    solve()

    
# -*- coding:utf-8 -*-



def solve():

    S = eval(input())



    num0 = 0

    num1 = 0

    for moji in S:

        if moji == "0":

            num0 += 1

        else:

            num1 += 1

    erase_num = min(num0, num1)

    print((erase_num*2))





if __name__ == "__main__":

    solve()

# -*- coding:utf-8 -*-
def solve():
    S = eval(input())
    ans = 0
    i = 0
    while i != len(S):
        if i + 1 >= len(S):
            break
        if S[i] != S[i + 1]:
            # 消す
            if i == 0:
                if len(S) <= 2:
                    ans += 1
                    S = ""
                    continue
                else:
                    ans += 1
                    S = S[2:]
                    continue
            else:
                if i + 2 < len(S):
                    ans += 1
                    S = S[:i] + S[i + 2 :]
                    i -= 1
                    continue
                else:
                    ans += 1
                    S = S[:i]
                    i -= 1
                    continue
        i += 1
    print((ans * 2))


if __name__ == "__main__":
    solve()

# -*- coding:utf-8 -*-
def solve():
    S = eval(input())
    num0 = 0
    num1 = 0
    for moji in S:
        if moji == "0":
            num0 += 1
        else:
            num1 += 1
    erase_num = min(num0, num1)
    print((erase_num * 2))


if __name__ == "__main__":
    solve()

-    ans = 0 -    i = 0 -    while i != len(S): -        if i + 1 >= len(S): -            break -        if S[i] != S[i + 1]: -            # 消す -            if i == 0: -                if len(S) <= 2: -                    ans += 1 -                    S = "" -                    continue -                else: -                    ans += 1 -                    S = S[2:] -                    continue -            else: -                if i + 2 < len(S): -                    ans += 1 -                    S = S[:i] + S[i + 2 :] -                    i -= 1 -                    continue -                else: -                    ans += 1 -                    S = S[:i] -                    i -= 1 -                    continue -        i += 1 -    print((ans * 2)) +    num0 = 0 +    num1 = 0 +    for moji in S: +        if moji == "0": +            num0 += 1 +        else: +            num1 += 1 +    erase_num = min(num0, num1) +    print((erase_num * 2))