Maximum Difference Between Even and Odd Frequency II
For each pair of digits, use prefix counts and parities to find the longest-gap substring whose first digit count is odd and second is an even, nonzero count.
For each pair of digits, use prefix counts and parities to find the longest-gap substring whose first digit count is odd and second is an even, nonzero count.