# -*- coding: utf-8 -*-

S = input()
N = len(S)
cnt = 0

# O(N^2)は不可。
# 010がある時、01と10を取り除くパターンを作る？
s = S
while True:
    c1 = s.count("01")
    c2 = s.count("10")
    if c1 == 0 and c2 == 0:
        break
    elif c1 >= c2:
        s = s.replace("01", "")
        cnt += c1*2
    else:
        s = s.replace("10", "")
        cnt += c2*2


# 時間超過
# s = set()
# s.add(S)
# while True:
#     #print(s)
#     s2 = set()
#     for d in s:
#         for i in range(len(d)-1):
#             if d[i] != d[i+1]:
#                 ns = None
#                 if i+2 < len(d):
#                     ns = d[:i]+d[i+2:]
#                 else:
#                     ns = d[:i]
#                 if ns is not None and len(ns) > 0:
#                     s2.add(ns)
#     if len(s2) > 0:
#         cnt += 2
#         s = s2
#     else:
#         break
#

print(cnt)
