import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String str = sc.nextLine();
        char[] dictionary = {'a', 'b', 'c', 'd', 'e', 'f', 'g',
                'h', 'i', 'j', 'k', 'l', 'm', 'n',
                'o', 'p', 'q', 'r', 's', 't',
                'u', 'v', 'w', 'x', 'y', 'z'};
        StringBuilder sb = new StringBuilder();
        for (char c : key.toCharArray()) {
            if (sb.indexOf(String.valueOf(c)) == -1) {
                sb.append(c);
            }
        }
        int i = 0;
        while (sb.length() < 26) {
            if (!sb.toString().contains(String.valueOf(dictionary[i]))) {
                sb.append(dictionary[i]);
            }
            i++;
        }
        char[] encryptDictionary = sb.toString().toCharArray();
        for (char c : str.toCharArray()) {
            // 查找字母在词典中的位置
            int position = Arrays.binarySearch(dictionary, c);
            System.out.print(encryptDictionary[position]);
        }
    }


}