const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
const map = {
0: ["a", "b", "c"],
1: ["d", "e", "f"],
2: ["g", "h", "i"],
3: ["j", "k", "l"],
4: ["m", "n", "o"],
5: ["p", "q", "r"],
6: ["s", "t"],
7: ["u", "v"],
8: ["w", "x"],
9: ["y", "z"],
};
const str = await readline();
const noLetter = await readline();
const res = [];
const dfs = (idx, path) => {
if (idx == str.length) {
if (!noLetter.includes(path.join(""))) {
res.push(path.join(""));
}
return;
}
const letters = map[Number(str[idx])];
for (const letter of letters) {
path.push(letter);
dfs(idx + 1, path);
path.pop();
}
};
dfs(0, []);
console.log(res.join(","));
})();