A = list(map(int,input()))
c = 0
i = 0
while True:
    d = 0
    while i < len(A)-1-c:
    #for i in range(len(A)-1-c):
        #print(i)
        if A[i] != A[i+1]:
            c += 2
            d = 1
            #print(A,c,i)
            for j in range(i,len(A)-c):
                A[j] = A[j+2]
            i -= 2
        i += 1
    if d == 0:
        break
print(c)

