a = dict(zip(map(str,range(10)),input())) print("".join(a[i] if i in a else i for i in input()))