# key = 'TRAILBLAZERS'
key = input()
# T R A I L B Z E S C D F G H J K M N O P Q U V W X Y
# mw = 'Attack AT DAWN'
mw = input()
zm = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
qcm = ''
for i in key:
    if i.upper() not in qcm:
        qcm += i.upper()
# print(qcm)   # TRAILBZESl
zmb = qcm
for i in zm:
    if i.upper() not in zmb:
        zmb += i.upper()
# print(zmb)
# TRAILBZESCDFGHJKMNOPQUVWXY
jmw = ''
for i in mw:
    # 先找明文字母在zm中的下标索引,以此下标索引去zmb中即可找到加密后的字母
    if i == ' ':
        jmw += ' '
    else:
        index = zm.index(i.lower())
        jz_zm = zmb[index]
        if i.islower():
            jmw += jz_zm.lower()
        else:
            jmw += jz_zm
print(jmw)

# Tpptad TP ITVH
# Tpptad TP ITVH