#coding: utf-8
import math

def main():
    S = input()
    counter = 0
    while(True):
        tmp_counter, S = pull_cubes(S)
        counter += tmp_counter
        if tmp_counter is 0 or len(S) is 0:
            break
    print(counter)

def pull_cubes(string):
    length = len(string)
    cube_counter = 0
    before_cube = string[0]
    index = 0
    for i in range(length):
        if index >= length:
            break
        if string[index] is not before_cube:
            string = string[0:index-1] + string[index+1:length]
            length -= 2
            cube_counter += 2
            index -= 1
            if len(string) is 0:
                break
            before_cube = string[index]
        else:
            before_cube = string[index]
            index += 1

    return cube_counter, string

if __name__ == "__main__":
    main()