def remove01Pair(R):
    for i in range(len(R) - 1):
        #print(i)
        if R[i:i + 2] == '01':
            R = R[:i] + R[i + 2:]
            #print(R)
            return R
    flag[0] = 1
    return R

def remove10Pair(R):
    for i in range(len(R) - 1):
        #print(i)
        if R[i:i + 2] == '10':
            R = R[:i] + R[i + 2:]
            #print(R)
            return R
    flag[0] = 1
    return R

N = input().strip()
#print(N)
length = len(N)
#print(length)
flag = []
flag.append(0)
while flag[0] == 0:
    N = remove01Pair(N)
    #print(N)
    #time.sleep(1)
flag[0] = 0
while flag[0] == 0:
    N = remove10Pair(N)
    #print(N)
    #time.sleep(1)
#print()
#print(len(N))
print(length - len(N))

