#include using namespace std; using ll = long long; int main(){ string s, t; cin >> s >> t; for(int i = 0; i < t.size(); i++){ if(!islower(t[i])) t[i] = s[t[i]-'0']; } cout << t << endl; return 0; }