import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); char[] a = sc.next().toCharArray(); char[] s = sc.next().toCharArray(); sc.close(); for (int i = 0; i < s.length; i++) { if ('0' <= s[i] && s[i] <= '9') { System.out.print(a[s[i] - '0']); } else { System.out.print(s[i]); } } } }