import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) { 
            String s = in.next();
            char[] c = new char[26];
            int j = 0;
            Set<Character> hs = new LinkedHashSet<>();
            for(int i = 0; i<s.length(); i++){
                hs.add(s.charAt(i));
            }
            for(char c1 = 'a'; c1<='z'; c1++){
                if(!hs.contains(c1)){
                    hs.add(c1);
                }
            }
            for(Character ch : hs){
                c[j] = ch;
                j++;
            }
            String s2 = in.next();
            for(int i = 0; i<s2.length(); i++){
                int k = (int)(s2.charAt(i)-(int)'a');
                System.out.print(c[k]);
            }
        }
    }
}