def f(s):
    ans = 0
    num = 0
    for c in s:
        if c == "0":
            num += 1
        else:
            if num > 0:
                num -= 1
                ans += 2
    return ans

def solve(s):
    return max(map(f, [s,s[::-1]]))

assert solve("0011") == 4
assert solve("11011010001011") == 12
assert solve("0") == 0

s = input()
print(solve(s))