def min_operations_to_good_string(s: str) -> int: cnt = 0 stack = [] for c in s: if c == '1': stack.append(1) else: # c == '0' if stack and stack[-1] == 1: stack.pop() # pair with previous 1 else: cnt += 1 # need to change this 0 to 1 return cnt