#include<iostream>
#include<string>
#include<cctype>
using namespace std;

int main()
{
    string MiYao,str;
    while(cin>>MiYao>>str)
    {
        //单词删减
        int lenght = MiYao.length();
        char *tmp = new char[26];
        int k = 0;
        for(int i=0; i<lenght; i++)
        {
            MiYao[i] = tolower(MiYao[i]);
        }
        for(int i=0; i<lenght; i++)
        {
            if(MiYao.find(MiYao[i])==i)
            {
               tmp[k] =tolower(MiYao[i]);
               k++;
            }
        }
        //cout<<tmp;
        //密文确定
        for(char a = 'a'; a-'a'<26; a++)
        {
            if(MiYao.find(a)==MiYao.npos)
            {
               tmp[k] = a;
               k++;
            }
        }
        //明文对密文
        int length = str.length();
        for(int i=0; i<length; i++)
        {
            if(str[i]-'a'>=0 && str[i]-'z'<=0)
            {
                cout<<tmp[str[i]-'a'];
            }
            else if(str[i]-'A'>=0 && str[i]-'Z'<=0)
            {
                cout<<toupper(tmp[str[i]-'a']);
            }
            else
            {
                cout<<str[i];
            }
        }
        cout<<endl;
    }
    return 0;
}