import sys input = sys.stdin.readline def getlist(): return list(map(int, input().split())) def main(): a = input() s = input() for c,i in zip(a,range(10)): s = s.replace(str(i),c) print(s) if __name__ == '__main__': main()