# -*- coding: utf-8 -*-
"""
C - Unification
https://atcoder.jp/contests/abc120/tasks/abc120_c

"""
import sys
import re


def my_sub(m):
    len1 = len(m.group(1))
    len2 = len(m.group(2))
    if len1 > len2:
        return m.group(1) * (len1 - len2)
    return m.group(2) * (len2 - len1)


def solve(S):
    orig_len = len(S)
    while True:
        t = re.sub(r'01', '', S)
        t = re.sub(r'10', '', t)
        if t == S:
            break
        S = t
    return orig_len - len(S)


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
