from sys import stdin


def b(input_string):
    _s = input_string
    s_length = len(_s)
    s = []
    for i in range(s_length):
        s.append(_s[i])
    #print(_s)
    #print(s)
    count = 0
    flag = True
    while flag and len(s) >= 2:
        flag = False
        for i in range(s_length):
            if i < len(s)-1:
                if s[i] != s[i+1]:
                    s.pop(i)
                    #print(s)
                    s.pop(i)
                    #print(s)
                    count += 2
                    flag = True
                    break
    return count



def main():
    input_line = stdin.readline().rstrip()
    answer = b(input_line)
    print(answer)


if __name__ == '__main__':
    main()
