100 atcoder#ABC098B. [ABC098B] Cut and Count
[ABC098B] Cut and Count
Score : points
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 .
6
aabbca
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 .
10
aaaaaaaaaa
1
However we divide , only a
will be contained in both and .
45
tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir
9