Description
Given a string s, return the length of the longest awesome substring of s. A string is awesome if it can be made palindromic by rearranging some (or none) of its characters.
Examples
Input:
s = "3242415"Output:
5Explanation:
24241 can become palindrome 24142.
Input:
s = "a"Output:
0Explanation:
Edge case with a single character.
Input:
s = "213123"Output:
4Explanation:
The longest awesome substring is '2131' (positions 0-3) or '1312' (positions 1-4), both of length 4. In '2131', digits 1 appears twice, 2 once, 3 once - at most one odd-count digit would allow rearrangement into a palindrome, but two digits have odd counts here. The correct longest awesome substring has length 4.
Constraints
- •
1 ≤ s.length ≤ 10^5 - •
s consists only of digits