fun main(args: Array<String>) {
    var count = 0
    var s = readLine()!!
    var newS = s
    do {
        s = newS
        newS = newS.replaceFirst(Regex("00|11"), "")
        if (s != newS) count++
    } while (s != newS)
    println(count * 2)
}
