import scala.io.StdIn._

object Main extends App {

  val s = readLine()

  def solve() = {
    var str = s
    var canRemove = true
    while(canRemove) {
      val removed = str.replaceAll("01", "").replaceAll("10", "")
      if(str == removed) canRemove = false
      str = removed
    }
    s.length - str.length
  }
  println(solve())

}

