import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit ={

    val sc = new Scanner(System.in)
//    val iS = sc.next

    val s = sc.next

    val stack =
      s.foldLeft( Seq.empty[Char] ){(stack, ch) =>
        ch match{
          case '0' if stack.headOption.contains('1') => ch +: stack
          case '0'                                   => stack.tail
          case '1' if stack.headOption.contains('0') => ch +: stack
          case '1'                                   => stack.tail
        }
      }

    val res = s.length - stack.length
    println(res)
  }
}