def jiami(key,info): a="abcdefghijklmnopqrstuvwxyz" b=a new_key="" for k in key: if k not in new_key: new_key+=k b=b.replace(k,"") my_map=dict(zip(a,new_key+b)) res="" for i in info: res+=my_map[i] return res print(jiami(input(),input()))