key = input() s = input() A = 'abcdefghijklmnopqrstuvwxyz' kkey = '' for i in key: if i not in kkey: kkey += i for i in A: if i not in kkey: kkey += i res = '' for i in s: res += kkey[A.index(i)] print(res)