#!/usr/bin/env python3
import sys


def solve(S: str):
    nS = len(S)
    pS = ""
    while pS != S:
        pS = S
        S = S.replace("01", "")
        S = S.replace("10", "")
    print(nS - len(S))


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
    solve(S)


if __name__ == '__main__':
    main()
