#!/usr/bin/env python3



def solve(S: str):

    stack = []

    N = len(S)

    for i, s in enumerate(S):

        if i == 0:

            stack.append(s)

        else:

            if len(stack) == 0:

                stack.append(s)

            else:

                if s != stack[-1]:

                    tmp = stack.pop()

                else:

                    stack.append(s)

    print((N - len(stack)))



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    S = str(eval(input()))

    solve(S)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3



def solve_short(S: str):

    print((2*min(S.count('0'), S.count('1'))))



def solve(S: str):

    stack = []

    N = len(S)

    for i, s in enumerate(S):

        if i == 0:

            stack.append(s)

        else:

            if len(stack) == 0:

                stack.append(s)

            else:

                if s != stack[-1]:

                    tmp = stack.pop()

                else:

                    stack.append(s)

    print((N - len(stack)))



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    S = str(eval(input()))

    solve_short(S)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3
def solve(S: str):
    stack = []
    N = len(S)
    for i, s in enumerate(S):
        if i == 0:
            stack.append(s)
        else:
            if len(stack) == 0:
                stack.append(s)
            else:
                if s != stack[-1]:
                    tmp = stack.pop()
                else:
                    stack.append(s)
    print((N - len(stack)))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    S = str(eval(input()))
    solve(S)


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
def solve_short(S: str):
    print((2 * min(S.count("0"), S.count("1"))))


def solve(S: str):
    stack = []
    N = len(S)
    for i, s in enumerate(S):
        if i == 0:
            stack.append(s)
        else:
            if len(stack) == 0:
                stack.append(s)
            else:
                if s != stack[-1]:
                    tmp = stack.pop()
                else:
                    stack.append(s)
    print((N - len(stack)))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    S = str(eval(input()))
    solve_short(S)


if __name__ == "__main__":
    main()

+def solve_short(S: str): +    print((2 * min(S.count("0"), S.count("1")))) + + -    solve(S) +    solve_short(S)