import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ClassToHome { public static void main(String[] args) { Scanner input = new Scanner(System.in); String key = input.nextLine(); String text = input.nextLine(); StringBuilder sb = new StringBuilder(); char[] keyArray = key.toCharArray(); List list = new ArrayList(); for (char c : keyArray) if (!list.contains(c)) list.add(c); String newKey = ""; for (Object o : list) { newKey = o + newKey; } char[] alphabet = new char[26]; for (int i = 0; i < list.size(); i++) alphabet[i] = newKey.charAt(i);
int n = 0; for (int i = list.size(); i < 26; ) { alphabet[i] = (char) ('z' - n); if (!list.contains(alphabet[i])) i++; n++; } for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (c < 'a' c > 'z') { sb.append(c); continue; } int ax = c - 'a'; sb.append(alphabet[ax]); } System.out.println(sb); } }