fun main(args : Array<String>) {
    val ss = readLine()!!

    val stack = mutableListOf<Char>()
    var count = 0

    for(i in ss.indices) {
        if (stack.size == 0) {
            stack.add(ss[i])
        } else if (stack.last() != ss[i]) {
            stack.removeAt(stack.size-1)
            count += 2
        } else {
            stack.add(ss[i])
        }
    }

    println(count)
}