A = input() S = input() for i, c in enumarate(S): if isdigit(c): S[i] = A[int(c)] print(S)