import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; public class broken { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new FileReader("broken.in")); for (;;) { int n = Integer.parseInt(br.readLine()); if (n==0) break; char[] input = br.readLine().toCharArray(); int x = 0, y=0; int max=0; HashMap hs = new HashMap(); for (; y=x; start--) { if (input[start]==input[x]) break; } for (int i=x; i<=start; i++) { int atimes = hs.get(input[i]) - 1; if (atimes==0) hs.remove(input[i]); else hs.put(input[i], atimes); x++; } hs.put(c, 1); } } if (max