#include using namespace std; int main(){ char A[11],S[101]; cin >> A >> S; for(int i=0;S[i]!='\0';i++){ if(S[i]>='0' && S[i]<='9')cout << A[S[i]-'0']; else cout << S[i]; } cout << endl; return 0; }