keys = input()
str1 = input()

s_tmp = set([])
keys_tmp = keys
keys = []
for i in keys_tmp:   # 对密钥去重
    if i not in s_tmp:
        keys.append(i)
        s_tmp.add(i)

az = list('abcdefghijklmnopqrstuvwxyz')  #生成字典的键

for i in az: #生成字典的值
    if i not in keys:  # 正常字母表不在密钥里的就按顺序拼接
        keys.append(i)

# print(keys)

dic = dict(zip(az,keys))

for i in str1:
    if 'A'<=i<='Z': # 默认是小写字母,大写字母要换成大写
        print(dic[i].upper(),end='')
    else:
        print(dic[i],end='')