#include using namespace std; using ll = long long; #ifdef LOCAL #include #else #define debug(...) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); string A, S; cin >> A >> S; for (char& c : S) { if (isdigit(c)) c = A[c - '0']; } cout << S << '\n'; }