#abc098b. [abc098_b]Cut and Count
[abc098_b]Cut and Count
Problem Statement
You are given a string of length consisting of lowercase English letters. We will cut this string at one position into two strings and . Here, we would like to maximize the number of different letters contained in both and . Find the largest possible number of different letters contained in both and when we cut the string at the optimal position.
Constraints
- consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the largest possible number of different letters contained in both and .
Sample Input 1
6
aabbca
Sample Output 1
2
If we cut the string between the third and fourth letters into aab
and bca
, the letters contained in both and are a
and b
. There will never be three or more different letters contained in both and , so the answer is .
Sample Input 2
10
aaaaaaaaaa
Sample Output 2
1
However we divide , only a
will be contained in both and .
Sample Input 3
45
tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir
Sample Output 3
9