s = t = input()

ans = 0
flag = True
while flag:
    s = s.replace('01','').replace('10','')
    if len(s) == len(t):
        flag = False
    else:
        ans += len(t) - len(s)
        t = s

print(ans)