main = getLine >>= print . solve 0 0 '0'

solve bw wb _ [] = min bw wb
solve bw wb '0' ('0':ss) = solve bw (wb + 1) '1' ss
solve bw wb '0' ('1':ss) = solve (bw + 1) wb '1' ss
solve bw wb '1' ('0':ss) = solve (bw + 1) wb '0' ss
solve bw wb '1' ('1':ss) = solve bw (wb + 1) '0' ss