a,s=input(),input() for i in s: if i.isdigit(): i=a[int(i)] print(i,end='') print()