s = input()
bef = len(s)
ans = 0
while(1):
    s = s.replace('10', '').replace("01", "")
    now = len(s)
    if bef == now:
        break
    else:
        ans += bef-now
        bef = now
print(ans)
