#yuki1337 r=input() s=input() res='' for i in range(len(s)): if s[i].isalpha(): res+=s[i] elif s[i].isdigit(): res+=r[int(s[i])] print(res)