#!/usr/bin/env python3

import sys



def solve(S: str):

    stack = [-1]

    for c in map(int, S):

        if stack[-1] + c == 1:

            stack.pop()

            continue

        stack.append(c)

    return len(S)-len(stack)+1



# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    S = next(tokens)  # type: str

    print((solve(S)))



def test():

    import doctest

    doctest.testmod()



if __name__ == '__main__':

    #test()

    main()

#!/usr/bin/env python3

import sys



def solve(S: str):

    from collections import Counter

    c = Counter(S)

    return 2 * min(c["0"], c["1"])



# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    S = next(tokens)  # type: str

    print((solve(S)))



def test():

    import doctest

    doctest.testmod()



if __name__ == '__main__':

    #test()

    main()

#!/usr/bin/env python3
import sys


def solve(S: str):
    stack = [-1]
    for c in map(int, S):
        if stack[-1] + c == 1:
            stack.pop()
            continue
        stack.append(c)
    return len(S) - len(stack) + 1


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    print((solve(S)))


def test():
    import doctest

    doctest.testmod()


if __name__ == "__main__":
    # test()
    main()

#!/usr/bin/env python3
import sys


def solve(S: str):
    from collections import Counter

    c = Counter(S)
    return 2 * min(c["0"], c["1"])


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    print((solve(S)))


def test():
    import doctest

    doctest.testmod()


if __name__ == "__main__":
    # test()
    main()

-    stack = [-1] -    for c in map(int, S): -        if stack[-1] + c == 1: -            stack.pop() -            continue -        stack.append(c) -    return len(S) - len(stack) + 1 +    from collections import Counter + +    c = Counter(S) +    return 2 * min(c["0"], c["1"])