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

public class enigmatic_mb_greedy {
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(new File("enigmatic.in"));
        String word = in.next();
        int n = in.nextInt();
        String[] numbers = new String[n];
        for (int i = 0; i < n; ++i) {
            numbers[i] = String.valueOf(in.nextInt());
        }
        in.close();

        List<String> answer = new ArrayList<String>();
        while (word.length() > 0) {
            int best = -1;
            for (int i = 0; i < n; ++i) {
                if (numbers[i] != null && word.startsWith(numbers[i])) {
                    if (best == -1 || numbers[i].length() > numbers[best].length()) {
                        best = i;
                    }
                }
            }
            if (best == -1) {
                throw new AssertionError("I've not found a solution");
            }
            answer.add(numbers[best]);
            word = word.substring(numbers[best].length());
            numbers[best] = null;
        }

        PrintWriter out = new PrintWriter("enigmatic.out");
        out.println(answer.size());
        for (String i : answer) {
            out.println(i);
        }
        out.close();
    }
}
