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