import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); char[] trans = sc.next().toCharArray(); StringBuilder sb = new StringBuilder(); for (char c : sc.next().toCharArray()) { if (c >= '0' && c <= '9') { sb.append(trans[c - '0']); } else { sb.append(c); } } System.out.println(sb); } }