#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <fstream>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
#include <sys/types.h>
#include <tuple>
#include <numeric>


typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;





int main()
{

    int Q;
    Q = 1;
    //cin >> Q;

    while (Q--) {
        string a, b;
        cin >> a >> b;
        for (int i = 0; i < b.size(); i++) {
            if (b[i] >= '0' && b[i] <= '9') {
                int x = b[i] - '0';
                cout << a[x];
            }
            else cout << b[i];
        }
    }
    return 0;
}