#include using namespace std; int main(){ string A, S; cin >> A >> S; for(char c : S){ if(isdigit(c)) cout << A[c - '0']; else cout << c; } cout << endl; }