public class Solution {
    public static Map<String, Integer> resultMap = new HashMap<>();

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String s;
        while (!(s = reader.readLine()).equals("exit")){
            new ReadThread(s).start();
        }
        reader.close();
    }

    public static class ReadThread extends Thread {
        String fileName;
        public ReadThread(String fileName) throws IOException {
            this.fileName = fileName;
        }
        public void run(){

            try {
                HashMap<Byte,Integer> map = new HashMap<>();
                FileInputStream inputStream = new FileInputStream(fileName);
                byte[] buffer = new byte[inputStream.available()];
                inputStream.read(buffer);
                inputStream.close();

                int count;
                for (byte b: buffer){
                    count = 0;
                    for (byte b1: buffer){
                        if (b == b1){
                            count++;
                        }
                    }
                    map.put(b, count);
                }
               // System.out.println("map = " + map);
                byte max = 0;

                for (Map.Entry<Byte,Integer> m: map.entrySet()){

                    for (Map.Entry<Byte,Integer> m1: map.entrySet()){

                        //System.out.println("m1 = " + m1.getKey());
                        //System.out.println("m = " + m.getKey());
                        if (m1.getValue()>m.getValue()){
                            max = m1.getKey();
                        }
                    }
                }
                synchronized (Solution.class) {
                    if (max !=0) {
                        resultMap.put(this.fileName, (int) max);
                    }else {
                        int count1 = 0;
                        for (Map.Entry<Byte,Integer> m1: map.entrySet()) {
                            if (count1 == 0) {
                                resultMap.put(this.fileName, Integer.valueOf(m1.getKey()));
                                count1++;
                            }
                        }
                    }
                }
               // System.out.println("resultMap = " + resultMap);

            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }
}