A = input() S = input() ans = [] # ord('A'):65 ord('a'):97 for s in S: if ord(s) >= 97: ans.append(s) else: ans.append(A[int(s)]) print(''.join(ans))