import java.util.Scanner; public class HelloWorld { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); char[] convert_rule = sc.nextLine().toCharArray(); char[] str_input = sc.nextLine().toCharArray(); sc.close(); for (int i = 0; i < str_input.length; i ++) { if (str_input[i] >= '0' && str_input[i] <= '9') { str_input[i] = convert_rule[str_input[i] - 48]; } } for (int i = 0; i < str_input.length; i ++) { System.out.print(str_input[i]); } System.out.println(""); } }