#include #define FastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { FastIO; string A, S; cin >> A >> S; for (auto ch : S) { if ('0' <= ch && ch <= '9') cout << A[ch - '0']; else cout << ch; } cout << '\n'; return 0; }