import java.util.* ; public class Main{ public static void main(String...args) { Scanner sc = new Scanner(System.in) ; while(sc.hasNextLine()) { String key = sc.nextLine() ; String target = sc.nextLine() ; System.out.println(code(key,target)) ; } } public static String code(String key , String target) { char k[] = key.toCharArray() ; char t[] = target.toCharArray() ; LinkedHashSet<Character> set = new LinkedHashSet<>() ; for(char ch : k) { if(isBig(ch)) { set.add(ch) ; } else { set.add((char)(ch-32)) ; } } char alp[] = new char[26] ; for(int i = 0 ; i < 26 ; i ++) { alp[i] = (char)('A'+ i) ; } for(char ch : alp) { set.add(ch) ; } char[] dic = new char[26] ; int abc = 0 ; for(char ch : set) { dic[abc++] = ch ; } String aplStr = new String(alp) ; StringBuilder mid = new StringBuilder() ; for(char ch : t) { if(isBig(ch)) { int index = aplStr.indexOf(ch) ; mid.append(dic[index]) ; } else { int index = aplStr.indexOf(ch-32) ; mid.append((char)(dic[index]+32)) ; } } return new String(mid) ; } public static boolean isBig(char ch) { if(ch >= 'A' && ch <= 'Z') { return true ; } return false ; } }