def main():
    S = list(input())

    ans = 0
    while True:
        cnt = 0
        for i in range(1,len(S)):
            if S[i] != S[i-1]:
                S.pop(i)
                S.pop(i-1)
                cnt += 2
                break
        if cnt == 0:
            break
        ans += cnt

    print(ans)



main()