S = eval(input())



stack = []

for s in S:

    if stack and stack[-1] != s:

        stack.pop()

    else:

        stack.append(s)

print((len(S) - len(stack)))
#!/usr/bin/env python3

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



from collections import Counter

S = eval(input())

c = Counter(S)

print((min(c.get('0', 0), c.get('1', 0)) * 2))
S = eval(input())
stack = []
for s in S:
    if stack and stack[-1] != s:
        stack.pop()
    else:
        stack.append(s)
print((len(S) - len(stack)))

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter

S = eval(input())
c = Counter(S)
print((min(c.get("0", 0), c.get("1", 0)) * 2))

+#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +from collections import Counter + -stack = [] -for s in S: -    if stack and stack[-1] != s: -        stack.pop() -    else: -        stack.append(s) -print((len(S) - len(stack))) +c = Counter(S) +print((min(c.get("0", 0), c.get("1", 0)) * 2))