st = input()
list_s = list(st)

delcount = 0
while True:
    if list_s.count('0') == 0 or list_s.count('1') == 0:
        break
    pre = list_s[0]
    count = 0
    for s in list_s:        
        if (pre == '0' and s == '1') or (pre == '1' and s == '0'):
            del list_s[count-1:count]
            delcount += 1
            break
        count += 1
print(delcount)
