S = list(input())
be = len(S)

while True:
    tmp_S = S
    for i in range(1,len(S)):
        if (S[i-1]=='0' and S[i]=='1') or (S[i-1]=='1' and S[i]=='0'):
            S[i-1], S[i] = '', ''
    S = ''.join(S)
    S = list(S)
    if tmp_S==S:
        break
af = len(S)
print(be-af)