s = input()
key = []
for i in s:
if i not in key:
keyappend(i)
key.reverse()
i=0
while len(key)<26:
t = chr(ord('z')-i)
if t not in key:
key.append(t)
i+=1
d = {}
for i in range(26):
d[chr(ord('a')+i)] = key[i]
old = input()
new = ''
for i in old:
if i not in d:
new += i
else:
new += d[i]
print(new)