a=list(input()) s=input() ans=[] for x in s: if ord('a')<=ord(x)<=ord('z'): ans.append(x) else: ans.append(a[int(x)]) print(''.join(ans))