A = input() S = input() ANS = "" for a in S: if 97 <= ord(a) < 97 + 26: ANS += a else: ANS += A[int(a)] print(ANS)