class Main
  def self.main lines
    s = lines[0]
    c = 0
    while true
      a = s.scan(/01/)
      s.gsub!(/01/, "")
      b = s.scan(/10/)
      s.gsub!(/10/, "")
      n = a.length + b.length
      return c if n == 0
      c += n*2
    end
  end
end

if $0 == __FILE__
#  $stdout = open('/dev/null', 'w')
  r = Main.main STDIN.readlines
#  $stdout = STDOUT
  puts r
end