a=input() s=input() b=[] for i in s: if '0'<=i<='9': b+=a[int(i)] else: b+=i print(''.join(b))