a = list(input()) s = list(input()) ans = "" for i in s: if i.isalpha(): ans += i else: ans += a[int(i)] print(ans)