def func():
    while True:
        try:
            enc, s = str(input()), str(input())
            old = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
            new = []
            dic = {}
            res = ''
            # 密码去重
            for i in enc:
                if i.upper() not in new:
                    new.append(i.upper())
            # 组装新的密码
            for i in old:
                if i.upper() not in new:
                    new.append(i)
            # print(''.join(new))
            # 字母偏移值
            for i in range(len(old)):
                dic[old[i]] = ord(new[i]) - ord(old[i])
            # print(dic)
            for i in s:
                res += chr(ord(i) + dic[i.upper()])
            print(res)
        except:
            break


if __name__ == '__main__':
    func()