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