public static ArrayList<Letter> extractLetters(ArrayList<Symbol> symbols) {
        ArrayList<Letter> letters = new ArrayList<Letter>();
        int letterStart = 0;
        for (int i = 0; i < symbols.size(); i++) {
            if (symbols.get(i).type == SymbolType.PAUSE) {
                if (i > 0) {
                    String s = symbolsToString(symbols.subList(letterStart + 1, i));
                    letters.add(new Letter(MORSE_CODE.containsKey(s) ? MORSE_CODE.get(s) : s + "?", symbols.get(letterStart).end, symbols.get(i).start));
                }
                letterStart = i;
            }
        }
        if (!symbols.isEmpty() && symbols.get(symbols.size() - 1).type != SymbolType.PAUSE) {
            String s = symbolsToString(symbols.subList(letterStart + 1, symbols.size()));
            letters.add(new Letter(MORSE_CODE.containsKey(s) ? MORSE_CODE.get(s) : s + "?", symbols.get(letterStart).end, symbols.get(symbols.size() - 1).start));
        }
        return letters;
    }