s = gets.chomp.chars
dpr = Array.new(s.size, 0)
dpb = Array.new(s.size, 0)
s.reverse.each.with_index do |c, j|
  dpr[j] = 1 if c == "0"
  dpb[j] = 1 if c == "1"
end
res = 0
(1...s.size).each do |i|
  dpr[i] += dpr[i - 1]
  dpb[i] += dpb[i - 1]
  t = [dpr[i], dpb[i]].min
  res = t if t > res
end
puts res * 2