S = input()
N = len(S)
 
for _ in range(N):
    fn = len(S)
    S = S.replace('01', '').replace('10', '').replace('01', '').replace('10', '').replace('01', '').replace('10', '')
    if fn == len(S):
        break
 
print(N - len(S))