#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    vector<char> res;
    for(char c: s) {
        if(find(res.begin(), res.end(), c) == res.end()) {
            res.push_back(c);
        }
    }

    for(char c = 'a'; c <= 'z'; ++c) {
        if(find(res.begin(), res.end(), c) == res.end()) {
            res.push_back(c);
        }
    }
    
    for(size_t i = 0; i < t.size(); ++i) {
        t[i] = res[t[i] - 'a'];
    }
    
    cout << t << endl;
    return 0;
}