You are given a binary string s of length n. Each character '1' in s represents an active section.
You are allowed to perform at most one trade operation:
Select a contiguous substring of '1's that is immediately flanked by '0's on both its left and right sides.
Let '0's immediately to the left of the selected substring, and let '0's immediately to its right.
The trade operation converts all characters in both '1's.
Return the maximum number of active sections in s after performing at most one trade operation.
Constraints:
s.length
s[i] is either '0' or '1'
You are given a binary string s of length n. Each character '1' in s represents an active section.
You are allowed to perform at most one trade operation:
Select a contiguous substring of '1's that is immediately flanked by '0's on both its left and right sides.
Let '0's immediately to the left of the selected substring, and let '0's immediately to its right.
The trade operation converts all characters in both '1's.
Return the maximum number of active sections in s after performing at most one trade operation.
Constraints:
s.length
s[i] is either '0' or '1'