import Foundation

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

while true {
    if S.contaisString("10") {
        S.stringByReplacingOccurrencesOfString("10", withString: "")
    } else if S.contaisString("01") {
        S.stringByReplacingOccurrencesOfString("01", withString: "")
    } else {
        break
    }
}

print(SLength - S.characters.count)