import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()

  val n = s.length
  if (n < 2) {
    println(0)
    return
  }

  var tmps = s
  while (has(tmps)) {
    tmps = conv(tmps)
  }

  println(n - tmps.length)
}

private fun has(s: String): Boolean {
  if (s.contains("01") || s.contains("10")) return true
  return false
}

private fun conv(s: String): String {
  val tmp = s.replace("01", "").replace("10", "")
  return tmp
}

