Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (a left substring and a right substring). The score is the number of zeros in the left substring plus the number of ones in the right substring.
Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (a left substring and a right substring). The score is the number of zeros in the left substring plus the number of ones in the right substring.
Example 1:
Input: {"s":"011101"}
Output: 5
Constraints:
2≤s.length≤500
s consists of the characters '0' and '1' only.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"011101"}
Before any cut, all 4 ones sit on the right and no zeros sit on the left. Each step moves the cut one character right.