#include #define rep(i, a, n) for(int i = a; i < n; i++) #define v(T) vector using namespace std; using ll = long long; using P = pair; int main() { string a, s; cin >> a >> s; string ans; rep(i, 0, s.size()){ if(0 <= s[i] - '0' && s[i] - '0' <= 9) ans.push_back(a[s[i] - '0']); else ans.push_back(s[i]); } cout << ans << endl; return 0; }