#coding: utf-8
import math

def main():
    S = input()
    result = pull_cubes(S)
    print(result)

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 -= 2
            cube_counter += 2
            index -= 1
            before_cube = string[index]
        else:
            before_cube = string[index]
            index += 1
    if cube_counter is 0:
        return cube_counter
    else:
        cube_counter += pull_cubes(string)
        return cube_counter

if __name__ == "__main__":
    main()