Given a binary string A. It is allowed to do at most one swap between any 0 and 1. Find and return the length of the longest consecutive 1’s that can be achieved.
The only argument given is string A.
Return the length of the longest consecutive 1’s that can be achieved. Constraints
1 <= length of string <= 1000000
A contains only characters 0 and 1.
Input 1: A = "111000"
Output 1: 3
Input 2: A = "111011101"
Output 2: 7