A = input() S = input() ans = "" for i in S: if str.isdigit(i) == True: #数字ならTrueを返す関数 ans += A[i] else: ans += i print(ans)