#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 or len(S) is 1:
            break
    print(counter)

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

if __name__ == "__main__":
    main()