import Foundation

var S = readLine()!
let SLength = S.characters.count

while S.containsString("0") && S.containsString("1") {
    if let r = S.rangeOfString("01") {
        S.removeRange(r)
    } else {
        S.removeRange(S.rangeOfString("10")!)
    }
}
print(SLength - S.characters.count)