100 #ABC098B. [ABC098B] Cut and Count

[ABC098B] Cut and Count

Score : 200200 points

Problem Statement

You are given a string SS of length NN consisting of lowercase English letters. We will cut this string at one position into two strings XX and YY. Here, we would like to maximize the number of different letters contained in both XX and YY. Find the largest possible number of different letters contained in both XX and YY when we cut the string at the optimal position.

Constraints

  • 2N1002 \leq N \leq 100
  • S=N|S| = N
  • SS consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

NN

SS

Output

Print the largest possible number of different letters contained in both XX and YY.

6
aabbca
2

If we cut the string between the third and fourth letters into X=X = aab and Y=Y = bca, the letters contained in both XX and YY are a and b. There will never be three or more different letters contained in both XX and YY, so the answer is 22.

10
aaaaaaaaaa
1

However we divide SS, only a will be contained in both XX and YY.

45
tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir
9