Given a string $$$S$$$ of length $$$N$$$, find the length of the longest substring$$$^\dagger$$$ $$$R$$$ such that: $$$$$$\sum_{c=\texttt{'a'}}^{\texttt{'z'}} freq[c] \cdot C \ge |R| \cdot max(R)$$$$$$
Where:
$$$\dagger$$$ Substring: obtained by deleting several (possibly zero) characters from the start of the string and several (possibly zero) characters from the end of the string.
The first line of the input contains a single integer $$$N$$$ ($$$1 \le N \le 10^5$$$) — the length of the string $$$S$$$.
The second line of the input contains a string $$$S$$$ of length $$$N$$$, consisting of lowercase English letters.
Output one line containing a single integer — the length of the longest substring that satisfies the condition.
4abcd
1
3bba
2