Problem:
 Score : 200 points    Problem Statement 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 1 6
aabbca      Sample Output 1 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 .       Sample Input 2 10
aaaaaaaaaa      Sample Output 2 1  However we divide S , only a will be contained in both X and Y .       Sample Input 3 45
tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir      Sample Output 3 9

Solution (Python):
n = int(input())
s = input()
ans = 0
key = ["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"]
for i in range(1, n):
    anssub = 0
    a, b = s[0:i], s[i:]
    for value in key:
        if value in a and value in b:
            anssub += 1
    if anssub > ans:
        ans = anssub
print(ans)

Solution (Python):
n=int(input())
s=input()
ans=0
for i in range(1,n):
    cnt=0
    a=s[:i]
    b=s[i:]
    for j in range(ord('a'),ord('z')+1):
        if a.count(chr(j)) and b.count(chr(j)): cnt+=1
    ans=max(ans,cnt)
print(ans)

Solution (Python):
n = int(input())
s = input()
res = 0

for i in range(1, n):


    count = 0
    for c in set(s[:i]):
        if c in s[i:]:
            count += 1

    res = max(res, count)
    
print(res)

Solution (Python):
N=int(input())
S=input()
ans=0
for j in range(1,N):
    s1=S[0:j]
    s2=S[j:N]
    cnt=0
    for i in set(s1):
        cnt+=i in set(s2)
    ans=max(ans,cnt)
print(ans)

Solution (Python):
from collections import Counter

N = int(input())
S = input()
ans = 0

for i in range(1, N+1):
    X = S[:i]
    Y = S[i:]
    c = Counter(X)

    count = 0
    for j in c:
        if j[0] in Y:
            count += 1

    ans = max(count, ans)

print(ans)

Solution (Python):
N=int(input())
S=input()
ans=0
for i in range(1,N):
  l=[]
  r=[]
  for j in range(i):
    l.append(S[j])
  for j in range(i,N):
    r.append(S[j])
  count=0
  for item in set(l):
    if item in r:
      count+=1
  if ans<count:
    ans=count
print(ans)

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

Solution (Python):
N = int(input())
S = input()
cnt = 0

for i in range(1, N):
    dup_cnt = set(S[:i]) & set(S[i:])
    if cnt < len(dup_cnt):
        cnt = len(dup_cnt)
print(cnt)

Solution (Python):
n=int(input())
s=str(input())

ans=0
for i in range(1,n):
    c=len(set(s[:i]) & set(s[i:]))
    
    if c>=ans:
        ans=c
print(ans)

Solution (Python):
n = int(input())
s = input()

ans = 0

for i in range(n - 1):
    ans = max(ans, len(set(s[:i + 1]) & set(s[i + 1:])))

print(ans)

Solution (Python):
N = int(input())
S = input()
ans = 0
for i in range(1,len(S)):
    l = []
    r = []
    for k in range(0,i):
        l.append(S[k])
    for k in range(i,len(S)):
        r.append(S[k])
    count = 0
    for item in set(l):
        if item in r:
            count += 1
    if ans < count:
        ans = count
    count = 0
print(ans)

Solution (Python):
n=int(input())
s=list(input())
M=0
for i in range(n-1):
    L=s[:i+1]
    R=s[i+1:]
    check={}
    cnt=0
    for c in L:
        if c not in check:
            check[c]=1
    for c in check:
        if c in R:
            cnt+=1
    M=max(M,cnt)
print(M)

Solution (Python):
n = int(input())
s = input()
ans = 0

for i in range(1,n):  
  num_kind = len(set(s[:i]).intersection(set(s[i:])))
  ans = max(ans,num_kind)

print(ans)

Solution (Python):
import numpy as np
import sys
n = int(input())
s = input()
ans = 0
for i in range(n-2):
    count = len(set(s[:i+1]))+len(set(s[i+1:]))-len(set(list(set(s[:i+1]))+list(set(s[i+1:]))))
    ans = max(ans,count)
print(ans)

Solution (Python):
n = int(input())
s = input()

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

print(ans)

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

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    mc = 0
    for i in range(1, n):
        cnt = 0
        ts1 = dict(collections.Counter(s[:i]).most_common()).keys()
        ts2 = dict(collections.Counter(s[i:]).most_common()).keys()
        for k, in ts1:
            if k in ts2:
                cnt += 1
        mc = max(mc, cnt)
    print(mc)


if __name__ == '__main__':
    slove()

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

Solution (Python):
_ = input()
S = input().strip()

ans = 0
for i in range(1,len(S)):
  x = S[:i]
  y = S[i:]
  ans = max(ans, len(set(x)&set(y)))
  
print(ans)

Solution (Python):
N = int(input())
S = input()

ans = 0
for i in range(1,N-1):
    s1 = set(list(S[:i]))
    s2 = set(list(S[i:]))
    n = len(s1 & s2)
    if ans < n:
        ans = n
print(ans)

Solution (Python):
N = int(input())
S = input()

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

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

Solution (Python):
n = int(input())
s = input()

m = 0
for i in range(1, n):
  a = s[:i]
  b = s[i:]
  c = len(set(a) & set(b))
  m = max(m, c)

print(m)

Solution (Python):
n = int(input())
s = input()
count = 0
for x in range(1, n):
    s1= s[0:x]
    s2= s[x:]
    S = set(s1) & set(s2)
    if len(S) > count:
        count = len(S)
print(str(count))

Solution (Python):
N = int(input())
S = input()
s_list = [s for s in S]
max_count = 0
for i in range(1, N):
    max_count = max(max_count, len(set(s_list[:i]) & set(s_list[i:])))
print(max_count)

Solution (Python):






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

ls = list(S)




max = 0


x = 1

for i in range(len(S)):
  a = ls[0:x]
  b = ls[x:]
  a_s = set(a)
  b_s = set(b)
  c = len(list(a_s & b_s))
  x +=1

  if c > max:
    max = c
    

print(max)

Solution (Python):
N = int(input())
S = input()
ss = [0]*N

if S.count(S[0]) == N:
  print(1)

else:
  for i in range(1, N):
    X = "".join(set(S[:i]))
    Y = "".join(set(S[i:]))
    for j in range(len(X)):
      if X[j] in Y:
        ss[i] += 1
  
  print(max(ss))

Solution (Python):
def count(s, t):
    hai=[]
    for i in range(len(s)):
        if not(s[i] in hai):
            hai.append(s[i])
    hai2=[]
    for i in range(len(t)):
        if not(t[i] in hai2):
            hai2.append(t[i])
    kotae=0
    for h in hai:
        if h in hai2:
            kotae+=1
    return kotae

n=int(input())
s=input()
kotae=0

for i in range(n):
    mae=s[:i]
    ato=s[i:]
    kazu=count(mae, ato)
    if kazu>=kotae:
        kotae=kazu

print(kotae)

Solution (Python):
n = int(input())
s = list(input())

maxi = 0
for i in range(1, n):
  x = []
  for c in s[:i]:
    if c not in x and c in s[i:]:
      x.append(c)
  maxi = max(maxi, len(x))
print(maxi)

Solution (Python):
N=int(input())
S=input()

ans=0
for i in range(1,N-1):
  s1=S[:i]
  s2=S[i:]
  ans=max(ans,len(set(list(s1)))+len(set(list(s2)))-len(set(list(S))))
print(ans)

Solution (Python):
N = int(input())
S = input()
maxtype = 0
for i in range(N):
    X = list(S[:i])
    Y = list(S[i:N+1])
    maxtype = max(len(set(X)&set(Y)), maxtype)
print(maxtype)

Solution (Python):
n = int(input())
s = input()
kinds = []
for i in range(1,n):
    
    l = s[0:i]
    r = s[i:]
    dubles = []
    for i in list(l):
        for j in list(r):
            if i == j:
                dubles +=[i]
    
    
    kinds += [len(set(dubles))]
    
    
print(max(kinds))

Solution (Python):
n = int(input())
s = input()
alphaList = "qwertyuiopasdfghjklzxcvbnm"
sMax = 0
for i in range(1, n):
    sSum = 0
    for j in range(26):
        if s[0:i].count(alphaList[j]) > 0 and s[i:n].count(alphaList[j]) > 0:
            sSum += 1
    sMax = max(sMax, sSum)
print(sMax)

Solution (Python):
n = int(input())
s = input()
c = []
for i in range(1,n):
  r = []
  for t in s[:i]:
    if t in s[i:]:
      r += [t]
  c += [len(set(r))]
print(max(c))

Solution (Python):
n = int(input())
s = input().strip()
res = 0
for i in range(1, n - 1):
    x = set(s[:i])
    y = set(s[i:])
    c = x.intersection(y)
    res = max(res, len(c))
print(res)

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

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
s = input()

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

Solution (Python):
n = int(input())
s = input()
ans = [0]*n
for i in range(n-1):
    cnt = 0
    x = list(set(s[0:i+1]))
    y = list(set(s[i+1:]))
    for j in range(len(x)):
        if x[j] in y:
            cnt += 1
    ans.append(cnt)
print(max(ans))

Solution (Python):
n = int(input())
s = input()
record = 0
for position in range(n):
  x = s[:position + 1]
  y = s[position + 1:]
  if len(set(x) & set(y)) > record:
    record = len(set(x) & set(y))
print(record)

Solution (Python):
n = int(input())
s = input()
count = 0
soFar = 0
for i in range(1, n):
    first = list(set(s[:i]))
    second = list(set(s[i:]))
    for j in range(len(first)):
        if first[j] in second:
            count += 1
    soFar = max(soFar, count)
    count = 0
print(soFar)

Solution (Python):
n = int(input())
s = input()
s = [ n for n in s ]
ans = 0

for i in range(1,n):
  a = set(s[:i])
  b = set(s[i:])
  c = len([ k for k in a if k in b ])
  if c > ans:
    ans = c
print(ans)

Solution (Python):
n = int(input())
s = input()
sum = 0
ans = 0
for i in range(n-1):
  a = set(list(s[:i]))
  b = set(list(s[i:]))
  sum =len(a&b)
  if sum > ans:
    ans = sum
print(ans)

Solution (Python):
n = int(input())

s = list(input())

res = 0
for i in range(1, n):
    temp = 0
    a = set(s[:i])
    b = set(s[i:])
    for j in a:
        if j in b:
            temp += 1
    if temp > res:
        res = temp

print(res)

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

Solution (Python):
N = int(input())
S = input()

count_list=[]
for i in range(1,N):
  X = S[0:i]
  Y = S[i:N]
  count=0
  temp = []
  for c in X:
    if c in Y:
      if c not in temp:
        count += 1
        temp.append(c)
  count_list.append(count)
print(max(count_list))

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

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

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

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

Solution (Python):
N = int(input())
S = input()
ans = []

for i in range(N - 1):
    s1 = set(S[:i + 1])
    s2 = set(S[i + 1:])
    ans.append(len(s1 & s2))

print(max(ans))

Solution (Python):
n = int(input())
s = input()

count = [0] * n
last = -1

for c in range(26):
    c = chr(ord("a")+c)
    last = -1
    for i in range(n):
        if s[i] == c:
            if last == -1:
                count[i] += 1
            last = i
    count[last] -= 1
 
ans = count[0]
for i in range(1, n):
    count[i] += count[i-1]
    ans = max(ans, count[i])

print(ans)

Solution (Python):
n = int(input())
s = input()
rcount = [0] * 26
for i in range(n):
    rcount[ord(s[i])-ord("a")] += 1
lcount = [0] * 26

ans = 0
cur = 0
for i in range(n):
    j = ord(s[i])-ord("a")
    lcount[j] += 1
    rcount[j] -= 1
    if lcount[j] == 1 and rcount[j] >= 1:
        cur += 1
    if rcount[j] == 0 and lcount[j] >= 2:
        cur -= 1
    ans = max(ans, cur)
print(ans)

Solution (Python):
N = int(input())
S = input()
from collections import defaultdict

ans = 0
L = "abcdefghijklmnopqrstuvwxyz"
for i in range(1,N):
    tmp = 0
    zen = S[:i]
    kou = S[i:]
    for j in L:
        if j in zen and j in kou:
            tmp += 1
    if tmp > ans:
        ans = tmp
print(ans)

Solution (Python):
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)

Solution (Python):
N = int(input())
S = list(input())
ans = 0
for i in range(1,N):
    a=0
    s1 = list(set(S[:i+1]))
    s2 = list(set(S[i+1:]))
    for j in range(len(s2)):
        a += list(set(s1)).count(s2[j])
    ans = max(ans, a)

print(ans)

Solution (Python):
N = int(input())
S = input()

answer = 0
for i in range(N):
    count = len(set(S[:i])&set(S[i:]))
    answer = max(count, answer)
print(answer)

Solution (Python):

n = int(input())
s = input()

ans=0
for i in range(n-1):
    start = s[0:i+1]
    end = s[i+1:]
    start = ''.join(set(start))
    c = 0
    for j in range(len(start)):
        if start[j] in end:
            c += 1
            ans = max(ans,c)
print(ans)

Solution (Python):
n = int(input())
s = input()
newlist = []
for ni in range(n):
    newlist.append([s[0:ni+1],s[ni+1:n]])
count = 0
for n in newlist:
    if len(set(n[0]) & set(n[1]))>count:
        count = len(set(n[0]) & set(n[1]))
print(count)

Solution (Python):
n=int(input())
s=input()
ans=0
for i in range(n-1):
    x=s[0:i+1]
    y=s[i+1:]
    x=''.join(set(x))
    cnt=0
    for j in range(len(x)):
        if x[j] in y:
            cnt+=1
    ans=max(cnt,ans)
print(ans)

Solution (Python):
N=int(input())
text=input()
ans=0
for i in range(1,N):
  texta=text[:i]
  textb=text[i:]
  seta=set(list(texta))
  setb=set(list(textb))
  m=len(seta&setb)
  if ans<m:
    ans=m
print(ans)

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

Solution (Python):

import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
S = IS()
max = 0
for i in range(1, N+1):
    cnt = 0
    a = set(S[:i])
    b = set(S[i:])
    for s in a:
        if s in b:
            cnt += 1
    if max < cnt:
        max = cnt
print(max)

Solution (Python):
N = int(input())
S = list(input())


max = 0

for half in range(N-1):

    X = S[0:half+1]
    Y = S[half+1:N] 

    set_X = set(X)
    set_Y = set(Y)
    tmp = len(set_X&set_Y)

    if tmp > max:
        max = tmp

print(max)

Solution (Python):
n = int(input())
s = input()

let = [chr(i) for i in range(97, 97 + 26)]

ans = 0
for i in range(1, n):
    l = s[:i]
    r = s[i:]
    cnt = 0
    for let_ele in let:
        if let_ele in l and let_ele in r:
            cnt += 1
    ans = max(ans, cnt)

print(ans)

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

Solution (Python):
N = int(input())
A = input()



cnt = 0
for n in range(1,N):
  before = A[:n]
  after = A[n:]
  
  

  _cnt = []
  for bef in before:
    if bef in after:
      _cnt.append(bef)
      
  cnt = max(cnt,len(set(_cnt)))

print(cnt)

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    m_cnt = 0
    for i in range(1, n):
        t1 = s[:i]
        t2 = s[i:]
        t1 = collections.Counter(t1)
        t2 = collections.Counter(t2)
        cnt = 0
        for k, v in t1.items():
            cnt += min(1, t2[k])
        m_cnt = max(m_cnt, cnt)
    print(m_cnt)


if __name__ == '__main__':
    slove()

Solution (Python):
import sys
from collections import deque
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    s = inputs[0]
    max_count = 0
    for i in range(1, len(s)):
        front = s[0:i]
        tail = s[i:]
        front_kind = set()
        tail_kind = set()

        for f in front:
            front_kind.add(f)

        for t in tail:
            tail_kind.add(t)

        count = len(front_kind & tail_kind)
        max_count = max([count, max_count])
    return max_count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

Solution (Python):
n=int(input())
S=input()

ans=0
for i in range(1,n+1):
  X=S[:i]
  Y=S[i:]
  tmp=[]
  for x in X:
    if x in Y:
      tmp.append(x)
  ans=max(ans,len(list(set(tmp))))
print(ans)

Solution (Python):
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)

Solution (Python):
import numpy as np

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

ans = 0
for i in range(N-1):
    left = set(list(S[:i+1]))
    right = set(list(S[i+1:]))
    ans = max(ans, len(left & right))
print(ans)

Solution (Python):
N = int(input())
S = list(input())

ans = 0
for i in range(1, N):
    temp = 0
    X = list(set(S[:i]))
    for j in X:
        if S[i:].count(j):
            temp += 1
    ans = max(ans, temp)
print(ans)

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

Solution (Python):
N = int(input())
S = input()
rs = []
for i in range(1, N):
  X = S[:i]
  Y = S[i:]
  r = len(set(X)&set(Y))
  rs.append(r)
r = max(rs)
print(r)

Solution (Python):
n = int(input())
s = input()
c = 0
 
for i in range(1,n):
  s1 = set(s[:i])
  s2 = set(s[i:])
  w = len(s1&s2)
  c = max(c,w)
    
print(c)

Solution (Python):
n = int(input())
s = input()
c = 0
 
for i in range(1,n):
  s1 = set(s[:i])
  s2 = set(s[i:])
  w = len(s1&s2)
  if w > c:
    c = w
    
print(c)

Solution (Python):
n = int(input())
s = input()
c = 0
tmp = 0

for i in range(1,n):
  s1 = list(set(s[:i]))
  s2 = list(set(s[i:]))
  for j in s1:
    if j in s2:
      tmp += 1
  if tmp > c:
    c = tmp
  tmp = 0
  
print(c)

Solution (Python):
N = int(input())
S = input()

import collections
c = 0
m = 0
for i in range(N):
  S1 = S[:i]
  S2 = S[i:]
  C1 = collections.Counter(S1)
  C2 = collections.Counter(S2)
  c = 0
  for c1 in C1.keys():
    if c1 in C2.keys():
      c += 1
  m = max(m,c)
print(m)

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())
S =  sys.stdin.readline().rstrip()

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

print(ans)

Solution (Python):
import sys
from collections import deque
from collections import  Counter
import statistics
import math

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
s = input()
c = Counter(s)
li = list(c.keys())
ans = -1
for i in range(n-1):
    ct = 0
    for c in li:
        if c in s[:i+1] and c in s[i+1:]:
            ct += 1
    ans = max(ans, ct)
print(ans)

Solution (Python):
N = int(input())
S = str(input())

ans = 0
for i in range(1, N):
    x = S[:i]
    y = S[i:]
    common = set(x) & set(y)
    ans = max(ans, len(common))

print(ans)

Solution (Python):
from collections import defaultdict

n = int(input())
s = input()
d = defaultdict(int)
for i in range(n):
    d[s[i]] += 1
dd = defaultdict(int)
ret = - float('inf')
for i in range(n):
    dd[s[i]] += 1
    cnt = 0
    for key in dd.keys():
        if d[key] - dd[key] > 0:
            cnt += 1
    ret = max(ret, cnt)
print(ret)

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

Solution (Python):
n = int(input())
s = input()
a = 'qwertyuiopasdfghjklzxcvbnm'

ans = 0
for i in range(n):
    cnt = 0
    for ai in a:
        if ai in s[:i] and ai in s[i:]:
            cnt += 1
    ans = max(ans, cnt)

print(ans)

Solution (Python):
n=int(input())
S=list(input())
r=0
for i in range(n):
    c=0
    for s in set(S[:i]):
        if s in S[i:]:
            c+=1
    r=max(r,c)
print(r)

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

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

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

Solution (Python):
N = int(input())
S = input()
count = 0
 
for i in range(N):
  attributeNum = len(set(S[0:i]) & set(S[i:]))
        
  if attributeNum > count and count<= N//2:
    count = attributeNum
 
print(count)

Solution (Python):
def test():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        set1 = set(s[:i])
        set2 = set(s[i:])
        ans = max(ans,len(set1 & set2))
    print(ans)


if __name__ == "__main__":
    test()

Solution (Python):


def main():

    N = int(input())
    S = input()
    count = 0

    for i in range(N):
        attributeNum = len(set(S[0:i]) & set(S[i:]))
        
        if attributeNum > count and count<= N//2:
            count = attributeNum

    print(count)


if __name__== "__main__":
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    m_cnt = 0
    for i in range(n):
        t_s = s[:i + 1]
        t_t = s[i + 1:]
        import collections
        t_s = collections.Counter(t_s)
        t_t = collections.Counter(t_t)
        cnt = 0
        for k, v in t_s.items():
            if k in t_t.keys():
                cnt += 1
        m_cnt = max(m_cnt, cnt)
    print(m_cnt)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
from collections import Counter
n = input()
s = input()
ans = 0
for i in range(len(s)):
  l = s[:i]
  r = s[i:]
  cnt = 0
  cl = Counter(l)
  for i in cl.keys():
    if i in r:
      cnt += 1
  if ans < cnt:
    ans = cnt
print(ans)

Solution (Python):
n=int(input())
s=input()

ans=0

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

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

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

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

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

Solution (Python):
n = int(input())
s = input()
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

Max = 0
for i in range(n+1):
    x = s[:i]
    y = s[i:]
    count = []
    ans = 0
    for i in alpha:
        if i in x and i in y and not i in count:
           ans += 1
           count.append(i)
    Max = max(Max,ans)
print(Max)

Solution (Python):
n = int(input())
s = input()

nums = []
for i in range(1, len(s)):
  x = s[:i]
  y = s[i:]
  x_letters = set(x)
  y_letters = set(y)
  num = 0
  for letter in x_letters:
    if letter in y_letters:
      num += 1
  nums.append(num)

print(max(nums))

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

Solution (Python):
N=int(input())
S=list(str(input()))
ans=[]
for i in range(N-1):
  num=0
  l=[]
  s1=S[0:i+1]
  s2=S[i+1:N]
  if len(s1)<=len(s2):
    s1,s2=s1,s2
  else:
    s1,s2=s2,s1
  for j in range(len(s1)):
    if s1[j] not in l:
      l.append(s1[j])
  for j in range(len(l)):
    if (l[j] in s2)==True:
      num+=1
  ans.append(num)
print(max(ans))

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

Solution (Python):
n=int(input())
s=list(input())
ans=0
for i in range(1,n-1):
  sum=0
  s1=set(s[:i])
  s2=set(s[i:])
  for j in s1:
    for k in s2:
      if j==k:
        sum+=1
        break
  if sum>ans:
    ans=sum
print(ans)

Solution (Python):
def main():
    N = int(input())
    S = input()
    max_count = 0
    for i in range(N-1):
        Aset = set(list(S[:i+1]))
        Bset = set(list(S[i+1:]))
        max_count = max(max_count, len(Aset & Bset))
    return max_count



if __name__ == '__main__':
    print(main())

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

Solution (Python):
N=int(input())
S=input()

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

Solution (Python):
n = int(input())
s = input()

max_cnt = 0
for i in range(1, n - 1):
    left = s[:i]
    right = s[i:]
    cnt = 0
    found = set()
    for c in left:
        if c not in found and right.find(c) != -1:
            cnt += 1
            found.add(c)
    max_cnt = max(max_cnt, cnt)

print(max_cnt)

Solution (Python):
N = int(input())
S = input()

count = 0

for i in range(N):
  X = S[:i]
  Y = S[i:]
  
  
  count = max(count, len(set(X) & set(Y)))
  
print(count)

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

Solution (Python):
import collections

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

max_count = 0

for i in range(N):
    a = S[:i]
    b = S[i:]

    a_2 = collections.Counter(a)
    b_2 = collections.Counter(b)

    dst = {}

    for k,v in b_2.items():
        if k in a_2:
            dst[k] = v

    max_count = max(max_count,len(dst))

print(max_count)

Solution (Python):
def resolve():
    n = int(input())
    s = input()
    max_common = 0
    for i in range(n):
        s1, s2 = s[:i + 1], s[i + 1:]
        common = len(set(set(s1) & set(s2)))
        if common > max_common:
            max_common = common
    print(max_common)


if __name__ == "__main__":
    resolve()

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(1,n-1):
    cnt = 0
    seen = []
    for char in s[:i]:
        if char in s[i:] and char not in seen:
            seen.append(char)
            cnt += 1
    ans = max(ans,cnt)
print(ans)

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

Solution (Python):
n = int(input())
s = input()
ans = 0
count = 0
for i in range(1,n):
  count = 0
  h = list(set(s[:i]))
  t = list(set(s[i:]))
  if len(h)>len(t):
    for j in range(len(h)):
      if h[j] in t:count+=1
  else:
    for j in range(len(t)):
      if t[j] in h:count+=1
  ans = max(ans,count)
print(ans)

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(1,n-1):
    cur = len(set(s[:i]) & set(s[i:]))
    if ans < cur:
        ans = cur
print(ans)

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(1,n-1):
    count = 0
    a = list(set(s[:i]))
    b = list(set(s[i:]))
    for j in range(len(a)):
        if a[j] in b:
            count += 1
    if ans < count :
        ans = count

print(ans)

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

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

Solution (Python):

N = int(input())
S = input()
ans = 0
for i in range(1, len(S)+1):
    left = set(S[:i])
    right = set(S[i:])

    x = len(left & right)
    ans = max(ans, x)

print(ans)

Solution (Python):
N = int(input())
S = input()

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

Solution (Python):
N = int(input())
S = input()
res = 0
for i in range(N):
  l, r = set(S[:i + 1]), set(S[i + 1:])
  res = max(res, len(l & r))
print(res)

Solution (Python):
N = int(input())
S = input()
ans = 0
for i in range(1,N):
    X = set(S[:i])
    Y = set(S[i:])
    count = 0
    for i in X:
        if i in Y:
            count += 1
        ans = max(ans, count)
print(ans)

Solution (Python):
n=int(input())
s=input()

abc='abcdefghijklmnopqrstuvwxyz'
res=[]

for i in range(1,n):
	l=s[:i]
	r=s[i:]
	n_l=len(l)
	n_r=len(r)
	cnt=0
	for j in range(26):
		x=abc[j]
		for k in range(n_l):
			if l[k]==x:
				for m in range(n_r):
					if r[m]==x:
						cnt+=1
						break
				break
	res.append(cnt)

print(max(res))

Solution (Python):
n=int(input())
s=list(input())
ans=0
for i in range(1,n):
    s1=s[:i]
    s2=s[i:]
    cnt=0
    for j in list(set(s1)):
        if j in s2:
            cnt+=1
    ans=max(ans, cnt)
print(ans)

Solution (Python):
N = int(input())
S = input()

right = {}
for s in S:
    right[s] = right.get(s, 0) + 1

answer = 0
left = {}
for s in S:
    left[s] = left.get(s, 0) + 1
    right[s] -= 1
    if right[s] == 0:
        del right[s]
    shared = len(set(left.keys()) & set(right.keys()))
    if shared > answer:
        answer = shared
print(answer)

Solution (Python):
from collections import Counter
N = int(input())
S = input()
def char_kinds(s1,s2):
    set1 = set(Counter(s1).keys())
    set2 = set(Counter(s2).keys())
    return len(set1 & set2)




ans = 0
for i in range(len(S)):
    if char_kinds(S[:i],S[i:]) >= ans:
        ans = char_kinds(S[:i],S[i:])
print(ans)

Solution (Python):
N = int(input())
S = input()

ans = 0
for i in range(1, len(S)):
    ans = max(ans, len(set(S[:i]).intersection(S[i:])))
print(ans)

Solution (Python):
n=int(input())
s=input()

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

Solution (Python):
n=int(input())
s=input()
mx=0
for i in range(n-1):
    L=set(s[:i+1])
    R=set(s[i+1:])
    tmp=len(L&R)
    if tmp>mx:
        mx=tmp
print(mx)