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