import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.HashMap;

public class Main {
    private static boolean isLetter(char c) {
        return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
    }

    private static void increaseFrequency(Map<String, Integer> words, String currentWord) {
        if (words.containsKey(currentWord)) {
            words.put(currentWord, words.get(currentWord) + 1);
        } else {
            words.put(currentWord, 1);
        }
    }

    private static boolean isMoreFrequent(StringBuilder currentWord, StringBuilder recurrentWord, int currentOcurance, int maxOcurance) {
        return (currentOcurance > maxOcurance) || (currentOcurance == maxOcurance && (recurrentWord == null || recurrentWord.compareTo(currentWord) > 0));
    }

    private static void updateRecurrentWord(StringBuilder recurrentWord, StringBuilder currentWord, int[] maxOcurance, int currentOcurance) {
        if (isMoreFrequent(currentWord, recurrentWord, currentOcurance, maxOcurance[0])) {
            recurrentWord.replace(0, recurrentWord.length(), currentWord.toString());
            maxOcurance[0] = currentOcurance;
        }
    }

    public static String frequestWord(BufferedReader reader) throws IOException, NullPointerException {
        Map<String, Integer> words = new HashMap<>();
        StringBuilder recurrentWord = null;
        int[] maxOcurance = new int[1];
        while (reader.ready()) {
            String currentLine = reader.readLine();
            StringBuilder currentWord = new StringBuilder();
            boolean wasLetter = false;
            int length = currentLine.length();
            for (int i = 0; i < length; ++i) {
                if (isLetter(currentLine.charAt(i))) {
                    currentWord.append(currentLine.charAt(i));
                    wasLetter = true;
                } else if (wasLetter) {
                    increaseFrequency(words, currentWord.toString());
                    updateRecurrentWord(recurrentWord, currentWord, maxOcurance, words.get(currentWord.toString()));
                    currentWord = new StringBuilder();
                    wasLetter = false;
                }
            }
            if (currentWord.length() > 0) {
                increaseFrequency(words, currentWord.toString());
                updateRecurrentWord(recurrentWord, currentWord, maxOcurance, words.get(currentWord.toString()));
            }
        }
        try {
            return recurrentWord.toString();
        } catch (Exception e) {
            return "Nu ai introdus nici-un text.";
        }
    }

    public static void main(String[] args) throws IOException, NullPointerException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        System.out.println(frequestWord(reader));
    }
}