#include using namespace std; #include using namespace atcoder; //using mint = modint1000000007; //using mint = modint998244353; template bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; } template bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; } #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef pair P; const ll INF = 3037000500; //const int INF=INT_MAX; //#define endl "\n" ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } ll lcm(ll a, ll b){return a * b / gcd(a, b);} int main(){ string a,s,t; cin>>a>>s; rep(i,s.size()){ if(isdigit(s[i])){ t.push_back(a[s[i]-'0']); }else t.push_back(s[i]); } cout<