S = gets.chomp

f = 1
str = S

while f == 1 do
    tmp = str.length
    str = str.gsub("01", "")
    str = str.gsub("10", "")
    if tmp == str.length then
        break
    end
end

print S.length - str.length