#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); string A,S; cin >> A; cin >> S; for(int i=0;i='0' && S[i]<='9') { S[i] = A[S[i]-'0']; } } cout << S << '\n'; return 0; }