#include <iostream>
#include <vector>
#include <stdio.h>
#include <map>
#include <string>
#include <cstdlib>

using namespace std;

string s;
int n, k;
map<string, int> dict;
vector<string> cons;
int cnt;

void rec(int p) {
	if (p == n) {
		cout << cnt << endl;
		for (int i = 0; i < cnt; i++) {
			cout << cons[i] << endl;
		}
		exit(0);
	} else {
		for (int i = 3; i > 0; i--){
			if (p + i> n)
				continue;
			string tmp = s.substr(p, i);
			if (dict[tmp] > 0){
				dict[tmp]--;
				cons[cnt++] = tmp;
				rec(p + i);
				dict[tmp]++;
				cnt--;
			}
		}
	}
}
int main() {
	freopen("enigmatic.in", "rt", stdin);
	freopen("enigmatic.out", "wt", stdout);
	cin >> s;
	n = s.size();
	cin >> k;
	for (int i = 0; i < k; i++) {
		string tmp;
		cin >> tmp;
		dict[tmp]++;
	}
	cons.resize(k);
	cnt = 0;
	rec(0);
	return 0;
}
