A = input() S = input() for i in range(10): S = S.replace(str(i),A[i]) print(S)