puts read_line.split(/0{2,}|^0+|0+$/).sum { |s| {s.count('0') + 2, s.count('1')}.min }