#!/usr/bin/env python3
import sys


def solve(S: str):
    ans = 0
    N = len(S)
    while True:
        S = S.replace('10', '').replace('01', '')
        if S.count('10') == 0 and S.count('01') == 0:
            break
    ans = N - len(S)
    print(ans)

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    S = str(input())
    solve(S)

if __name__ == '__main__':
    main()
