'use strict'

const canRemove = (arr) => {
    for(let i = 0; i < arr.length - 1; i++) {
        if (arr[i] !== arr[i + 1]) return i 
    }
    return false
}

const remove = (arr, i) => {
    arr.splice(i, 2)
    return arr
}

const main = (input) => {
    let arr = input.split('\n')[0].split('')
    let ans = 0

    while(true){
        let i = canRemove(arr)
        if (i !== false) {
            arr = remove(arr, i)
            ans += 2
        } else {
            console.log(ans)
            return
        }
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))