s = gets.chomp

ary = s.split('')
stack = []
p = s[0]
count = 0
ary.each do |c|
  if c == p
    stack.push c
  else
    if stack.size > 0
      stack.pop
      count += 1
    else
      stack.push c
      p = c
    end
  end
end
puts count * 2
