import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Mugs { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int chars = Integer.parseInt(br.readLine()); //Na pozici 20 length List charPoints = new ArrayList<>(); int bestLenght = 1; for (int i = 0; i < chars; i++){ char c = (char)br.read(); for (int[] mp:charPoints) { mp[c - 'a']++; mp[20]++; if(checkValid(mp)){ if(mp[20] > bestLenght){ bestLenght = mp[20]; } } } int[] temp = new int[21]; temp[c - 'a']++; temp[20]++; charPoints.add(temp); } System.out.println(bestLenght); } public static boolean checkValid(int[] charOccur){ int odd = 0; for (int i = 0; i < 20; i++) { odd += charOccur[i] % 2 == 1 ? 1 : 0; } return odd <= 1; } }