import java.util.*

fun main(args: Array<String>) = yorukatsu15b()

fun yorukatsu15b() {
    val s = readLine()!!

    val deque = ArrayDeque<Char>()

    var answer = 0

    for (c in s) {
        if (deque.isNotEmpty() && deque.peek() != c) {
            deque.poll()
            answer++
        } else {
            deque.addLast(c)
        }
    }

    answer *= 2

    println(answer)
}
