var ch : string; a, b : array[0..200] of longint; n, i, t, res : longint; begin read(ch); n := length(ch); for i := 0 to 199 do b[i] := 0; for i := 1 to n do begin a[i] := ord(ch[i]) - ord('0'); b[i] := b[i-1] + a[i]; end; res := b[n]; t := 0; for i := n downto 1 do begin if a[i] = 0 then inc(t); if (b[i-1] + t < res) then res := b[i-1] + t; end; writeln(res); end.
输入:1001101011001101101011110001
输出:1