879. Largest Variance Substring

0

Hard

The variance of a string is determined by the maximum difference between the frequencies of any two characters in the string. These characters can be the same or different. Given a string s consisting only of lowercase English letters, find and print the largest possible variance among all substrings of s. A substring is a contiguous sequence of characters within a string.

Input Format

A single line containing a string s.

Output Format

An integer representing the largest variance of the given string.

Example

Input

aababbb

Output

3

Constraints

1 <= N <= 104
Loading...

View Submissions

Console