# 2024年10月30日 周三 上午11:12
AA = "abcdefghijklmnopqrstuvwxyz"
key = input()
s = input()
k = ""
res = ""
for i in key:
if i not in k:
k += i
for i in AA:
if i not in k:
k += i
for i in s:
if i in AA:
res += k[AA.index(i)]
print(res)

京公网安备 11010502036488号