import java.util.*

fun main(args : Array<String>) {
    val S = readLine()!!
    val stack = Stack<Char>()
    var answer = 0

    S.forEach {
        // see stack top
        val top = if (!stack.empty()) {
            stack.peek()
        } else it

        val canRemove = it != top
        if (canRemove) {
            answer += 2
            stack.pop()
        } else {
            stack.push(it)
        }
    }

    println(answer)
}
