import java.util.Scanner

fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  var S = scanner.next()
  val length = S.length
  scanner.close()
  while (S.indexOf("01") != -1 || S.indexOf("10") != -1) {
    S = S.replace("01","").replace("10","")
  }
  print(length - S.length)
}