fun solve(cubes: String,acc:Int = 0): Int {
    val N = cubes.length
    val valid_indices = 0.until(N-1).filter {
        cubes[it] == '0' && cubes[it+1] == '1'
    }
    val cubes_reversed = cubes.reversed()
    val valid_indices_reversed = 0.until(N - 1).filter {
        cubes_reversed[it] == '0' && cubes_reversed[it+1] == '1'
    }

    val using_indices = if(valid_indices.size > valid_indices_reversed.size) {valid_indices} else {valid_indices_reversed}

    return if (using_indices.size == 0) {
        acc
    } else {
        1.until(using_indices.size-1).map{
            cubes.substring(using_indices[it-1]+2,using_indices[it])
        }.joinToString("").let{
           cubes.substring(0, using_indices[0]) + it + cubes.substring(using_indices.last()+2)
        }.let{
            // println(it)
            solve(it, acc + using_indices.size * 2)
        }
    }
}

fun main(args:Array<String>) {
    val S = readLine()!!    
    solve(S).run(::println)
}