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

-----Constraints-----
 - 2 \leq N \leq 100
 - |S| = N
 - S consists of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
N
S

-----Output-----
Print the largest possible number of different letters contained in both X and Y.

-----Sample Input-----
6
aabbca

-----Sample Output-----
2

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

Difficulty: EASY

Solutions:
N = int(input())
S = input()
ans = 0
for i in range(1, N):
	ans = max(ans, len(set(list(S[:i])) & set(list(S[i:]))))
print(ans)


N = int(input())
S = input()
cnt = 0
for i in range(N):
	s1 = set(S[:i])
	s2 = set(S[i:])
	l: int = len(s1 & s2)
	if l > cnt:
		cnt = l
print(cnt)


n = int(input())
s = input()
ans = 0
for i in range(n):
	sf = set(s[:i])
	sl = set(s[i:])
	ans = max(len(sf & sl), ans)
print(ans)


N = int(input())
S = list(input())
res = 0
for i in range(1, N):
	cnt = set(S[0:i]) & set(S[i:N])
	if res < len(cnt):
		res = len(cnt)
print(res)


n = int(input())
s = input()
print(max((len(set(s[:i]) & set(s[i:])) for i in range(n))))


n = int(input())
s = input()
count_list = []
for i in range(1, n):
	x = s[:i]
	y = s[i:]
	xset = set(x)
	xlist = list(xset)
	count = 0
	for j in xlist:
		if j in y:
			count += 1
	count_list.append(count)
print(max(count_list))


N = int(input())
S = input()
ans = 0
for i in range(1, N):
	L = set(S[:i])
	R = set(S[i:])
	ans = max(ans, len(L & R))
print(ans)


n = int(input())
s = input()
(tmp, ans) = (0, 0)
for i in range(n + 1):
	s0 = []
	for j in range(n):
		if j < i:
			t = True
			for x in s0:
				if x == s[j]:
					t = False
			if t:
				s0.append(s[j])
		else:
			for k in range(len(s0)):
				if s0[k] == s[j]:
					tmp += 1
					s0[k] = -1
	(tmp, ans) = (0, max(ans, tmp))
print(ans)


_ = input()
S = input()
print(max([len(set(S[:i]) & set(S[i:])) for i in range(len(S))]))


n = int(input())
s = input()
ans = 0
for i in range(1, n):
	ans = max(ans, len(set(s[0:i]) & set(s[i:])))
print(ans)


N = int(input())
S = input()
R = -1
for n in range(1, N):
	R = max(len(set(S[:n]) & set(S[n:])), R)
print(R)


n = int(input())
s = input()
l = []
for i in range(n):
	l.append(len(list(set(s[:i]) & set(s[i:]))))
print(max(l))


n = int(input())
s = input()
shurui = []
for i in range(len(s) - 1):
	zenhan = s[0:i + 1]
	kouhan = s[i + 1:len(s)]
	kaburu = []
	kaburu.clear()
	a = 0
	for j in range(len(zenhan)):
		if kouhan.count(zenhan[j]) != 0 and kaburu.count(zenhan[j]) == 0:
			a += 1
			kaburu.append(zenhan[j])
	shurui.append(a)
print(max(shurui))


n = int(input())
s = input()
cnt = 0
for i in range(n):
	tmp = len(set(s[:i]) & set(s[i:]))
	cnt = max(tmp, cnt)
print(cnt)


N = int(input())
S = input()
res = -1
for i in range(N):
	res = max(len(set(S[:i]) & set(S[i:])), res)
print(res)


n = int(input())
st = input()
l = []
for i in range(n + 1):
	l.append(len(set(st[:i]) & set(st[i:])))
print(max(l))


N = int(input())
S = input()
print(max([len(set(S[:i]).intersection(set(S[i:]))) for i in range(N)]))


n = int(input())
s = input()
print(max([len(set(s[:x]) & set(s[x:])) for x in range(1, n)]))


N = int(input())
S = input()

def f(s, t):
	set_s = set()
	set_t = set()
	for i in s:
		set_s.add(i)
	for i in t:
		set_t.add(i)
	return len(set_s & set_t)
ans = 0
for i in range(1, N):
	s = S[i:]
	t = S[:i]
	ans = max(ans, f(s, t))
print(ans)


n = int(input())
s = input()
c = 0
for i in range(1, len(s)):
	l = set(s[:i])
	r = set(s[i:])
	c = max(c, len(l & r))
print(c)


n = int(input())
s = input()
a = []
for i in range(1, n):
	a.append(len(set(s[:i]) & set(s[i:])))
print(max(a))


n = int(input())
s = input()
a = 0
for i in range(n):
	x = set(s[:i])
	y = set(s[i:])
	a = max(a, len(x & y))
print(a)


n = int(input())
text = list(input())
print(max([len(set(text[:i]) & set(text[i:])) for i in range(1, n)]))


N = int(input())
S = input()
a = 0
for i in range(1, N - 1):
	a = max(a, len(set(S[:i]) & set(S[i:])))
print(a)


n = int(input())
s = input()
count = 0
for i in range(1, n - 1):
	a = len(set(s[:i]) & set(s[i:]))
	count = max(count, a)
print(count)


n = int(input())
s = input()
count = []
for i in range(1, n):
	first = s[:i]
	second = s[i:]
	count.append(len(set(first) & set(second)))
print(max(count))


n = int(input())
s = input()
ans = 0
for i in range(1, n):
	cnt = 0
	l = set(s[:i])
	r = set(s[i:])
	for v in l:
		if v in r:
			cnt += 1
	ans = max(ans, cnt)
print(ans)


N = int(input())
S = input()
list = [0] * N
for i in range(N):
	A = S[:i]
	B = S[i:]
	A = set(A)
	B = set(B)
	for j in A:
		if j in B:
			list[i] += 1
list = sorted(list)
print(list[-1])


n = int(input())
s = input()
mx = -1
for i in range(1, n):
	x = set(s[0:i])
	y = set(s[i:])
	mx = max(mx, len(x & y))
print(mx)


N = int(input())
S = input()
res = 0
for i in range(1, N):
	com = set(S[:i]) & set(S[i:])
	if res < len(com):
		res = len(com)
print(res)


n = int(input())
s = input()
data = []
ans = 0
for i in range(n - 1):
	if s[i] not in data:
		data.append(s[i])
	res = 0
	for j in data:
		if j in s[i + 1:n]:
			res += 1
	ans = max(ans, res)
print(ans)


n = int(input())
s = list(input())
ans = []
for i in range(1, n):
	first_falf = set(s[:i])
	after_falf = set(s[i:])
	count = 0
	for word in first_falf:
		if word in after_falf:
			count += 1
	ans.append(count)
print(max(ans))


N = int(input())
S = list(input())
dic = {}
for i in range(N):
	if S[i] not in dic.keys():
		dic[S[i]] = [i]
	else:
		dic[S[i]].append(i)
ans = 0
for j in range(1, N):
	cnt = 0
	for k in dic.values():
		check1 = False
		check2 = False
		for l in k:
			if l < j:
				check1 = True
			if j <= l:
				check2 = True
		if check1 and check2:
			cnt += 1
	ans = max(ans, cnt)
print(ans)


N = int(input())
s = input()
result = 0
for i in range(N - 1):
	a = set(s[:i])
	b = set(s[i:])
	result = max(result, len(a & b))
print(result)


input()
a = input()
print(max((len(set(a[:s]) & set(a[s:])) for s in range(99))))


def main():
	n = int(input())
	s = input()
	ans = 0
	for i in range(1, n):
		cnt = 0
		(x, y) = (set(s[:i]), set(s[i:]))
		for j in x:
			if j in y:
				cnt += 1
		ans = max(ans, cnt)
	print(ans)
main()


n = int(input())
s = input()
match = []
for i in range(1, len(s)):
	s1 = list(s[:i])
	s2 = list(s[i:])
	cnts = []
	for j in s1:
		if j in s2:
			if j not in cnts:
				cnts.append(j)
	match.append(len(cnts))
print(max(match))


import sys
from io import StringIO
import unittest
from collections import Counter

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '6\naabbca'
		output = '2'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '10\naaaaaaaaaa'
		output = '1'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir'
		output = '9'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	S = input()
	ans = 0
	for i in range(1, N - 1):
		x = Counter(S[0:i])
		y = S[i:]
		tmp = 0
		for j in list(x.keys()):
			if j in y:
				tmp += 1
		ans = max(ans, tmp)
	print(ans)

def __starting_point():
	resolve()
__starting_point()


n = int(input())
s = input()
print(max((len(set(s[0:m]) & set(s[m:n])) for m in range(n))))


N = int(input())
N_List = list(map(str, input().strip()))
ans = 0
for i in range(1, N):
	c_ans = len(set(N_List[:i]) & set(N_List[i:]))
	if c_ans > ans:
		ans = c_ans
print(ans)


N = int(input())
s = input()
print(max([len(set(s[:n]).intersection(s[n:])) for n in range(1, N)]))


N = int(input())
S = list(str(input()))
nax = 0
for i in range(1, N - 1):
	nax = max(nax, len(set(S[:i]) & set(S[i:])))
print(nax)


(n, a) = (input(), input())
print(max((len(set(a[:s]) & set(a[s:])) for s in range(len(a)))))


import sys
input = sys.stdin.readline
N = int(input())
S = list(input().strip())
ans = 0
for i in range(N):
	ans = max(ans, len(set(S[:i]) & set(S[i:])))
print(ans)


N = int(input())
S = input()
ans = 0
for i in range(N):
	l = S[:i]
	r = S[i:]
	now = len(set(l) & set(r))
	ans = max(ans, now)
print(ans)


n = int(input())
s = list(map(str, input()))
ansl = []
for i in range(1, n):
	ans = 0
	x = list(set(s[:i]))
	y = list(set(s[i:]))
	for j in range(len(x)):
		if x[j] in y:
			ans += 1
	ansl.append(ans)
print(max(ansl))


N = int(input())
S = input()
max_count = 0
for i in range(0, N - 1):
	X = S[0:i + 1]
	Y = S[i + 1:]
	X_set = set(X)
	Y_set = set(Y)
	count = len(X_set & Y_set)
	if max_count < count:
		max_count = count
print(max_count)


n = int(input())
s = input()
s = list(s)
x = []
for i in range(n):
	a = s[:i]
	b = s[i:]
	cnt = 0
	c = set(a)
	d = set(b)
	c = list(c)
	d = list(d)
	for j in range(len(c)):
		for k in range(len(d)):
			if c[j] == d[k]:
				cnt += 1
				break
	x.append(cnt)
print(max(x))


n = int(input())
s = input()
cnt = 0
for i in range(1, n):
	l = []
	for j in s[:i]:
		if j in s[i:]:
			l.append(j)
	l = set(l)
	cnt = max(cnt, len(l))
print(cnt)


n = int(input())
s = input()
ans = 0
for i in range(1, len(s)):
	s1 = s[:i]
	s2 = s[i:]
	cnt = set()
	for j in s1:
		if j in s2:
			cnt.add(j)
	ans = max(ans, len(cnt))
print(ans)


n = int(input())
s = input()
cnt = 0
for i in range(1, n - 1):
	tmp = 0
	(r, l) = (s[:i], s[i:])
	rs = list(set(r))
	for ri in rs:
		if l.count(ri) > 0:
			tmp += 1
	cnt = max(cnt, tmp)
print(cnt)


n = int(input())
s = input()
max_count = 0
for i in range(1, n):
	s1 = ''.join(set(s[:i]))
	s2 = ''.join(set(s[i:]))
	count = 0
	for j in range(len(s1)):
		if s1[j] in s2:
			count += 1
	if count > max_count:
		max_count = count
print(max_count)


N = int(input())
S = input()
ans = 0
for i in range(1, N):
	A = set(S[:i])
	B = set(S[i:])
	ans = max(ans, len(A & B))
print(ans)


N = int(input())
S = input()
ans = 0
for i in range(N - 1):
	L = S[:i + 1]
	R = S[i + 1:]
	c = 0
	for l in set(L):
		if l in R:
			c += 1
	ans = max(ans, c)
print(ans)


n = int(input())
s = list(input())
m = 0
for x in range(1, n):
	f = s[:x]
	b = s[x:]
	m = max(m, len(set(f) & set(b)))
print(m)


n = int(input())
s = input()
ans = 0
for i in range(1, n - 1):
	a = set(s[:i])
	b = set(s[i:])
	q = max(len(a), len(b))
	t = 0
	if ans >= q:
		continue
	if len(a) >= len(b):
		w = list(a)
		h = list(b)
	else:
		w = list(b)
		h = list(a)
	for k in range(q):
		if w[k] in h:
			t += 1
	ans = max(ans, t)
print(ans)


N = int(input())
S = input()
print(max([len(set(S[:x]) & set(S[x:])) for x in range(N)]))


N = int(input())
S = input()
ans = 0
for i in range(N - 1):
	F = set(S[:i + 1])
	G = set(S[i + 1:])
	ans = max(ans, len(F & G))
print(ans)


n = int(input())
s = list(input())
mx = 0
for i in range(1, n):
	m = len(set(s[:i]) & set(s[i:]))
	if m > mx:
		mx = m
print(mx)


def calc_intersection():
	n = int(input())
	s = input()
	list_intersection = []
	for i in range(1, n):
		a = set(s[:i])
		b = set(s[i:])
		intersection_a_b = a.intersection(b)
		list_intersection.append(len(intersection_a_b))
	return max(list_intersection)

def __starting_point():
	print(calc_intersection())
__starting_point()


(n, s) = (int(input()), input())
tmp = []
for i in range(1, n):
	tmp.append(len(list(set(s[:i]) & set(s[i:]))))
print(max(tmp))


n = int(input())
s = input()
l = []
for n in range(n):
	m = len(set(s[:n]) & set(s[n:]))
	l.append(m)
print(int(max(l)))


n = int(input())
s = input()
b = 0
for i in range(n):
	a = set(s[:i]) & set(s[i:])
	b = max(b, len(a))
print(b)


N = int(input())
S = str(input())
_sum = 0
visited = set()
_sum_visited = set()
max_size = len(set(S))
for n in range(N - 1):
	if S[n] in S[n + 1:] and S[n] not in visited:
		_sum += 1
	elif S[n] in visited and S[n] not in S[n + 1:]:
		_sum -= 1
	visited.add(S[n])
	_sum_visited.add(_sum)
	last_size = len(set(S[n + 1]))
	ans = max(_sum_visited)
	if ans == max_size:
		break
print(max(_sum_visited))


n = int(input())
s = input()
a = 0
for i in range(n):
	b = sum((j in s[i:] for j in set(s[:i])))
	a = max(a, b)
print(a)


N = int(input())
S = input()
ans = 0
for i in range(N):
	s1 = set(S[:i])
	s2 = set(S[i:])
	ans = max(len(s1 & s2), ans)
print(ans)


N = int(input())
s = input()
print(max([len(set(s[i:]) & set(s[:i])) for i in range(1, N)]))


t = input()
s = input()
n = 0
for i in range(len(s)):
	a = set(s[:i])
	b = set(s[i:])
	t = len(a & b)
	if t > n:
		n = t
print(n)


N = int(input())
S = input()
result = max((sum((c in S[i:] for c in set(S[:i]))) for i in range(N)))
print(result)


n = int(input())
S = input()
ans = 0
for i in range(1, n):
	(X, Y) = (S[:i], S[i:])
	cnt = 0
	for x in set(X):
		if x in Y:
			cnt += 1
	ans = max(cnt, ans)
print(ans)


n = int(input())
s = input()
ans = 0
for i in range(n - 1):
	a = set()
	b = set()
	for j in range(i):
		a.add(s[j])
	for j in range(i, n):
		b.add(s[j])
	ans = max(ans, len(a & b))
print(ans)


n = int(input())
k = list((x for x in input()))
print(max((len(set(k[:i]) & set(k[i:])) for i in range(0, n))))


n = int(input())
S = input()
ans = 0
for i in range(1, n):
	a = set(S[:i])
	b = set(S[i:])
	c = a & b
	ans = max(ans, len(c))
print(ans)


N = int(input())
S = input()
m = []
for i in range(N):
	m.append(len(set(S[:i]) & set(S[i:])))
print(max(m))


n = int(input())
s = list(input())
ans = 0
for i in range(1, n):
	count = 0
	x = sorted(set(s[:i]))
	y = sorted(set(s[i:]))
	for j in x:
		if j in y:
			count += 1
	ans = max(ans, count)
print(ans)


N = int(input())
S = input()
ans = 0
for i in range(N):
	(s1, s2) = (set(S[:i]), set(S[i:]))
	tmp = len(s1.intersection(s2))
	if tmp > ans:
		ans = tmp
print(ans)


n = int(input())
s = list(input())
t = 0
for i in range(1, n):
	t = max(len(set(s[:i]) & set(s[i:])), t)
print(t)


N = int(input())
A = input()
ans = 0
for n in range(1, N - 1):
	ans = max(ans, len(set(A[:n]) & set(A[n:])))
print(ans)


n = int(input())
l = list(input())
c = 0
for i in range(1, n):
	c = max(c, len(set(l[:i]) & set(l[i:])))
print(c)


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '6\naabbca'
		output = '2'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '10\naaaaaaaaaa'
		output = '1'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir'
		output = '9'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	S = input()
	ans = 0
	for i in range(1, N - 1):
		x = set(S[0:i])
		y = set(S[i:])
		ans = max(ans, len(x & y))
	print(ans)

def __starting_point():
	resolve()
__starting_point()


(n, s) = open(0)
print(max((len(set(s[:i]) & set(s[i:])) for i in range(int(n)))))


n = int(input())
s = input()
a = []
for i in range(1, len(s)):
	s1 = list(s[:i])
	s2 = list(s[i:])
	b = []
	for j in s1:
		if j in s2 and j not in b:
			b.append(j)
	a.append(len(b))
print(max(a))


N = int(input())
S = list(input())
m = 0
for i in range(N):
	m = max(m, len(set(S[:i]) & set(S[i:])))
print(m)


N = int(input())
S = input()
ans = 0
for i in range(N):
	s = set(S[:i]) & set(S[i:])
	ans = max(ans, len(s))
print(ans)


def answer(n: int, s: str) -> int:
	result = 0
	for i in range(1, n):
		x = set(s[i:])
		y = set(s[:i])
		common_characters = x.intersection(y)
		result = max(result, len(common_characters))
	return result

def main():
	n = int(input())
	s = input()
	print(answer(n, s))

def __starting_point():
	main()
__starting_point()


input()
s = input()
a = 0
for i in range(1, len(s) - 1):
	x = set(s[:i]) & set(s[i:])
	if a < len(x):
		a = len(x)
print(a)


n = int(input())
s = list(input())
ans = 0
for i in range(1, n):
	(x, y) = (set(s[:i]), set(s[i:]))
	ans = max(ans, len(x & y))
print(ans)


N = int(input())
S = input()
list1 = []
for i in range(N):
	x = set()
	for s in S[:i + 1]:
		if s in S[i + 1:]:
			x.add(s)
	list1.append(len(x))
print(max(list1))


n = int(input())
s = input()
c = 0
for i in range(1, n):
	p = set(s[:i])
	b = set(s[i:])
	c = max(c, len(p & b))
print(c)


import collections
n = int(input())
s = input()
ans = 0
for l in range(1, n):
	s1 = s[:l]
	s2 = s[l:]
	s1 = collections.Counter(s1)
	s2 = collections.Counter(s2)
	num = 0
	for i in s1:
		if i in s2:
			num += 1
			ans = max(ans, num)
print(ans)


(n, s, c) = (int(input()), list(input()), 0)
for i in range(n):
	h = len(set(s[:i]) & set(s[i:]))
	c = max(c, h)
print(c)


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	n = i_input()
	s = s_input()
	ans = 0
	for i in range(n):
		l = set(s[:i])
		r = set(s[i:])
		trial = 0
		for k in l:
			if k in r:
				trial += 1
		ans = max(ans, trial)
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
s = input()
c = 0
for i in range(1, n - 1):
	x = set(s[:i])
	y = set(s[i:])
	cap = x & y
	c = max(c, len(cap))
print(c)


n = int(input())
s = list(input())
ans = 0
c = 0
fh = []
lh = s
for i in range(n):
	tmp = lh.pop(0)
	if tmp not in fh:
		if tmp in lh:
			c += 1
	elif tmp not in lh:
		c -= 1
	fh.append(tmp)
	ans = max(ans, c)
print(ans)


n = int(input())
s = input()
ans = []
for i in range(1, n):
	cnt = 0
	A = set(s[:i])
	B = set(s[i:])
	for j in A:
		if j in B:
			cnt += 1
	ans.append(cnt)
print(max(ans))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
from collections import deque
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	N = I()
	s = S()
	ans = 0
	for i in range(N):
		a = s[:i]
		b = s[i:]
		c = len(set(a).intersection(set(b)))
		ans = max(c, ans)
	print(ans)
main()


N = int(input())
S = input()
m = 0
for i in range(N):
	S1 = S[:i]
	S2 = S[i:]
	p = set(S1) & set(S2)
	m = max(m, len(p))
print(m)


n = int(input())
s = input()
c = 0
for i in range(n - 1):
	xy = set(s[i + 1:]) & set(s[:i + 1])
	c = max(c, len(xy))
print(c)


n = int(input())
s = input()
list_intersection = []
for i in range(1, n + 1):
	a = set(s[:i])
	b = set(s[i:])
	intersection_a_b = a.intersection(b)
	list_intersection.append(len(intersection_a_b))
print(max(list_intersection))


input()
s = input().rstrip()
ans = 0
for i in range(1, len(s)):
	ans = max(ans, len(set(s[:i]) & set(s[i:])))
print(ans)


input()
s = input()
x = 0
for i in range(len(s)):
	a = s[0:i]
	b = s[i:]
	x = max(x, len(set(a) & set(b)))
print(x)


N = int(input())
S = input()
max_cnt = 0
for i in range(1, N):
	x = set(S[0:i])
	y = set(S[i:N])
	x_y = len(x & y)
	if x_y > max_cnt:
		max_cnt = x_y
print(max_cnt)


N = int(input())
s = list(input())
a = []
for i in range(1, N):
	a.append(len(list(set(s[0:i]) & set(s[i:]))))
print(max(a))


n = int(input())
s = list(input())
res = 0
for i in range(2, n - 1):
	res = max(res, len(set(s[:i]) & set(s[i:])))
print(res)


import sys
lines = [s.rstrip('\n') for s in sys.stdin.readlines()]
(n,) = [int(num) for num in lines.pop(0).split(' ')]
s = lines.pop(0)
ans = 0
for i in range(n):
	intersection = set(s[:i]) & set(s[i:])
	num = len(intersection)
	if num > ans:
		ans = num
print(ans)


n = int(input())
s = str(input())
ans = 0
for i in range(1, n):
	l = list(s[0:i])
	r = list(s[i:n])
	dup = len(set(l) & set(r))
	if ans < dup:
		ans = dup
print(ans)


n = int(input())
word = input().strip()
print(max([len(set([s for s in word[:i] if s in word[i:]])) for i in range(1, n)]))


n = int(input())
S = input().strip()
print(max((len(set(S[:i + 1]) & set(S[i + 1:])) for i in range(n - 1))))


n = int(input())
s = input()
ans = 0
for i in range(n):
	t1 = set(s[:i])
	t2 = set(s[i:])
	ans = max(ans, len(t1 & t2))
print(ans)


(_, a) = open(0)
print(max((len(set(a[:s]) & set(a[s:])) for s in range(99))))


N = input()
S = input()
c = 0
for i in range(1, len(S)):
	c = max(c, len(set(S[:i]) & set(S[i:])))
print(c)


n = int(input())
S = list(input())
ans = 0
for i in range(1, n - 1):
	L = S[:i]
	R = S[i:]
	UL = set(L)
	UR = set(R)
	ans = max(ans, len(UL & UR))
print(ans)


N = int(input())
S = [i for i in input()]
ANS = []
for i in range(1, N + 1):
	ans = 0
	A = []
	B = []
	A = list(set(S[:i]))
	B = list(set(S[i:]))
	for a in A:
		for b in B:
			if a == b:
				ans += 1
	ANS.append(ans)
print(max(ANS))


N = int(input())
s = input()
L = []
for i in range(N):
	A = set(s[:i])
	B = set(s[i:])
	L.append(len(A & B))
print(max(L))


n = int(input())
s = input()
ans = 0
for i in range(n):
	s1 = s[:i]
	s2 = s[i:]
	ans = max(ans, len(set(s1) & set(s2)))
print(ans)


(n, S) = open(0)
print(max([len(set(S[:c]) & set(S[c:])) for c in range(len(S))]))


N = int(input())
S = input()
cnt = []
for n in range(1, N):
	x = sorted(S[:n])
	y = sorted(S[n:])
	cnt.append(len(set(x) & set(y)))
print(max(cnt))


N = int(input())
S = input()
ans = 0
for k in range(1, N):
	ans = max(ans, len(set(S[:k]) & set(S[k:])))
print(ans)


n = int(input())
S = input()
ans = 0
for i in range(1, len(S)):
	S1 = S[:i]
	S2 = S[i:]
	cnt = set()
	for s1 in S1:
		if s1 in S2:
			cnt.add(s1)
	ans = max(ans, len(cnt))
print(ans)


n = int(input())
s = input()
a = 0
for i in range(1, n):
	x = set(s[:i])
	y = set(s[i:])
	b = len(x & y)
	if b > a:
		a = b
print(a)


N = int(input())
S = input()
m = 0
for i in range(1, N):
	X = S[0:i]
	Y = S[i:]
	a = len(set(X) & set(Y))
	if a > m:
		m = a
print(m)


n = int(input())
s = input()
L = ''
R = ''
C = ''
tmp = 0
ans = []
for i in range(1, len(s)):
	L = s[:i]
	R = s[i:]
	C = len(set(L) & set(R))
	ans.append(C)
	L = ''
	R = ''
print(max(ans))


N = int(input())
S = list(input())
ma = -1
for i in range(1, N):
	ma = max(ma, len(set(S[:i]) & set(S[i:])))
print(ma)