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