fun main(arr: Array<String>) {
    val s = readLine()!!.toMutableList()
    var idx = 0
    var ans = 0
    while (idx < s.size - 1) {
        if(s[idx] != s[idx+1]) {
            s.removeAt(idx)
            s.removeAt(idx)
            ans += 2
            idx = Math.max(0, idx-1)
        } else {
            idx++
        }
    }
    println(ans)
}
