key = input() s = input() res = '' alp1 = 'abcdefghijklmnopqrstuvwxyz' # 构造alp2,与alp1对相对应 alp2 = '' for i in key + alp1: if i not in alp2: alp2 += i # 对应取值 for i in s: res += alp2[alp1.find(i)] print(res)