import sys
dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]

def main():
    S  = list(map(int, input()))

    del_cnt = 0
    while True:
        mark = []
        now_p = 0
        now_S = len(S)
        while now_S-1 > now_p:
            if S[now_p] == S[now_p + 1]:
                now_p += 1
            else:
                mark.extend([now_p,now_p+1])
                del_cnt += 1
                now_p += 2

        S = dellist(S, mark)
        if not mark:
            break

        mark = []

    print(del_cnt * 2)

main()