A = list(input())
N = len(A)

ans = 0

flg = True
while flg:
    flg = False
    for i in range(N-1):
        if A[i] != A[i+1]:
            ans += 2
            N -= 2
            flg = True
            for j in range(i, N):
                A[j] = A[j+2] 
            break

print(ans)
