#include using namespace std; typedef long long ll; #define REP(i, n) for(int i=0; i=0; i--) #define FOR(i, m, n) for(int i=m; i; using LP = pair; using Graph = vector>; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 1e9; const ll LINF = (1LL<<60); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string a,s; cin >> a >> s; REP(i,s.size()){ if(s[i]>='0' && s[i]<='9') s[i] = a[s[i]-'0']; } cout << s << endl; return 0; }