import Foundation

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

while S.containsString("10") || S.containsString("01") {
    S = S.stringByReplacingOccurrencesOfString("10", withString: "")
  	S = S.stringByReplacingOccurrencesOfString("01", withString: "")
}

print(SLength - S.characters.count)