A=input() S=list(input()) for i in range(len(S)): if S[i]<='9': S[i]=A[int(S[i])] print(*S,sep='')