import qualified Data.Set as S

f::String->S.Set Char
f t1 =S.fromList t1

f2::Int->String->[Int]
f2 n t
   |null (drop n t)==True =[]
   |otherwise=let s1=f (take n t)
                  s2=f (drop n t)
                  s3=S.intersection s1 s2
              in S.size s3 : f2 (n+1) t

main =do
        e<-getLine
        e2<-getLine
        putStrLn $ show $ maximum $ f2 1 e2