import java.util.Scanner

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