import java.io.*;
import java.util.*;

public class enigmatic_mb_slow_ok_1 {
    static final int MAX_LENGTH = 3;

    static char[][] words;
    static int[] lengths;
    static int[][] mayStart;
    static char[] mainWord;

    static boolean[] used;
    static int[] curr;
    static int[] best;
    static int bestSize;

    static void go(int wordPosition, int currSize) {
        if (wordPosition == mainWord.length) {
            if (currSize < bestSize) {
                System.arraycopy(curr, 0, best, 0, currSize);
                bestSize = currSize;
            }
        }
        if (currSize >= bestSize/* || currSize + (mainWord.length - wordPosition + MAX_LENGTH - 1) / MAX_LENGTH >= bestSize*/) {
            return;
        }
        int[] currMayStart = mayStart[wordPosition];
        for (int next : currMayStart) {
            if (!used[next]) {
                used[next] = true;
                curr[currSize] = next;
                go(wordPosition + lengths[next], currSize + 1);
                used[next] = false;
            }
        }
    }

    private static void myAssert(String msg, boolean exp) {
        if (!exp) {
            throw new AssertionError(msg);
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("enigmatic.in"));
        mainWord = in.readLine().toCharArray();
        {
            for (char c : mainWord) {
                myAssert("Illegal character in N", '0' <= c && c <= '9');
            }
            myAssert("Length of N is illegal", 1 <= mainWord.length && mainWord.length <= 45);
            myAssert("N starts with zero", mainWord[0] != '0');
        }
        int wordCount = Integer.parseInt(in.readLine());
        myAssert("K is out of bounds", 1 <= wordCount && wordCount <= 1000);
        int[] inWords = new int[wordCount];
        Set<Integer> allWords = new HashSet<Integer>();
        StringTokenizer st = new StringTokenizer(in.readLine());
        for (int i = 0; i < wordCount; ++i) {
            inWords[i] = Integer.parseInt(st.nextToken());
            myAssert((i + 1) + "th number is illegal", 0 <= inWords[i] && inWords[i] < 1000);
            myAssert("Duplicate numbers", !allWords.contains(inWords[i]));
            allWords.add(inWords[i]);
        }
        in.close();
        Arrays.sort(inWords);
        lengths = new int[wordCount];
        words = new char[wordCount][];
        for (int i = 0, j = wordCount - 1; i < wordCount; ++i, --j) {
            words[i] = String.valueOf(inWords[j]).toCharArray();
            lengths[i] = words[i].length;
        }
        mayStart = new int[mainWord.length][];
        for (int i = 0; i < mainWord.length; ++i) {
            List<Integer> candidates = new ArrayList<Integer>();
            for (int j = 0; j < wordCount; ++j) {
                if (i + lengths[j] <= mainWord.length) {
                    boolean ok = true;
                    for (int t = 0; t < lengths[j]; ++t) {
                        ok &= mainWord[i + t] == words[j][t];
                    }
                    if (ok) {
                        candidates.add(j);
                    }
                }
            }
            mayStart[i] = new int[candidates.size()];
            for (int j = 0; j < mayStart[i].length; ++j) {
                mayStart[i][j] = candidates.get(j);
            }
        }

        used = new boolean[wordCount];
        curr = new int[mainWord.length];
        best = new int[mainWord.length];
        bestSize = mainWord.length + 2;

        go(0, 0);

        myAssert("No partition exists", bestSize <= mainWord.length);

        PrintWriter out = new PrintWriter("enigmatic.out");
        out.println(bestSize);
        for (int i = 0; i < bestSize; ++i) {
            out.println(words[best[i]]);
        }
        out.close();
    }
}
