while True:
    try:
        a = input()
        b = input()
    except:
        break
    else:
        #生成密文:
        zh = "abcdefghijklmnopqrstuvwxyz"
        mw = ""
        for i in a:
            if not i in mw:
                mw += i
        for i in zh:
            if not i in mw:
                mw += i
        minwen = ''
        for i in b:
            minwen += mw[zh.index(i)]
        print(minwen)