const rl = require("readline").createInterface({
input: process.stdin,
output: process.stdout,
});
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
let s = await readline();
let t = await readline();
let uniqueS = Array.from(new Set(s));
let alphabet = "abcdefghijklmnopqrstuvwxyz".split("");
let newAlphabet = uniqueS
.filter((letter) => alphabet.includes(letter))
.concat(alphabet.filter((letter) => !uniqueS.includes(letter)))
.join("");
let encrypted = t
.split("")
.map((char) => {
let index = alphabet.indexOf(char);
return newAlphabet[index];
})
.join("");
console.log(encrypted);
})();