#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=998244353; constexpr ll INF=1e18; int main(){ string a, s; cin >> a >> s; map mp; REP(i,10){ mp[(char)('0'+i)]=a[i]; } for(auto c:s){ if(c>='0'&&c<='9') cout << mp[c]; else cout << c; } cout << endl; return 0; }