d=input() s=input() a='' for c in s: if c.isdigit():a+=d[int(c)] else:a+=c print(''.join(a))