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.
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
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.