import sys
input = sys.stdin.readline
list1 = list(input())
del list1[-1]
ans = 0
def func(flist):
    i = 0
    flag = 0
    global ans
    while len(flist)>i+1:
        if flist[i] != flist[i+1]:
            flag = 1
            del flist[i],flist[i]
            ans += 1
        else:
            i+=1
    if not flag:
        return False
    else:
        return True
if __name__ == "__main__":
    while True:
        if not func(list1):
            break
    print(ans*2)