protected static void doPhoneNumbers() {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String phone = in.next();
        Integer dictionarySize = in.nextInt();
        for (int i = 0; i < dictionarySize; i++) {
            String word = in.next();
            String number = convertWordToNumber(word);
            List<Integer> indexes = getAllSubstringIndexes(phone, number);
            for (int startInd : indexes)
                addWord(startInd, word);
        }

        List<String> sentence = getSentenceRepresentation(phone.length());
        Iterator<String> itr = sentence.iterator();
        while (itr.hasNext()) {
            String echo = itr.next();
            echo = (itr.hasNext()) ? echo + " " : echo;
            out.print(echo);
        }
        out.flush();
    }