s = gets.strip
count = 0
res = 0
changed = false
#p s
loop do
  count = 0
  until (count + 1) >= s.length do
    #p count
    if s[count] != s[count + 1]
      s.slice!(count)
      s.slice!(count)
      res += 2
      changed = true
    else
      count += 1
    end
    #p s
  end
  #p "--"
  #p changed
  if !changed
    #puts res
    break
  end
  changed = false
  #p "--------"
end
puts res