Count minimum removals to obtain strings of the form "00000 . . . . " or "11111 . . . "
ans = min ( total_zeros , total_ones ) NEW_LINE cur_zeros = 0 NEW_LINE cur_ones = 0 NEW_LINE for x in str : NEW_LINE