S=list(input())
s=len(S)
#while any((S[i]== '0' and S[i+1]=='1') or (S[i]== '1' and S[i+1]=='0')for i in range(len(S)-1)

while any((S[i]== '0' and S[i+1]=='1') or (S[i]== '1' and S[i+1]=='0')for i in range(len(S)-1)):
    for j in range(len(S)-1):
        if j+1<len(S) and ((S[j]== '0' and S[j+1]=='1') or (S[j]== '1' and S[j+1]=='0')):
            S.pop(j)
            S.pop(j)

print(s-len(S))