import sys
input = sys.stdin.readline
s = input()
n = len(s)
ok = 0
while ok == 0:
    ok = 1
    i = 0
    while i < len(s) - 1:
        str = s[i] + s[i+1]
        if str == "01" or str == "10":
            s = s[:i] + s[i+2:]
            ok = 0
        i += 1
print(n - len(s))