S = input()
N = len(S)
#print(N)
for _ in range(N//2):
    S = S.replace('01','').replace('10','')
    if S.count('01') == 0 and S.count('10') == 0:
        #print("break")
        break
print(N - len(S))