#include using namespace std; int ctoi(char c){ if (c >= '0' && c <= '9') { return c - '0'; } return -1; } int main(void){ string a, s; cin >> a >> s; for (int i = 0; i < (int)s.size(); i++) { int m = ctoi(s[i]); if (m != -1) { s[i] = a[m]; } } cout << s << endl; }