A = input() S = input() ans = '' for i in S: if i.isdecimal(): ans += A[int(i)] else: ans += i print(ans)