import sys
sys.setrecursionlimit(10**6)

s=list(input())
n=len(s)

count=0
flag=1
while flag!=0:
    flag=0
    for i in range(n):
        if s[i]=="#":
            continue 
        for j in range(i,n):
            if s[i]!=s[j] and s[j]!="#":
                s[i]="#"
                s[j]="#"
                flag+=1
                count+=1
                break
    if flag==0:
        print(2*count)

