public class Main {
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
while(sc.hasNext()){
String key=sc.nextLine();
String word=sc.nextLine();
Set<Character> chs=new HashSet<>();
HashMap<Character,Character> mp=new HashMap<>();
int count=0;;
//把key中首次出现的字符依次与字母表abc..abc建立映射
for(char i:key.toCharArray()){
if(!chs.contains(i)){
chs.add(i);
char temp=(char)('a'+count++);
mp.put(temp,i);
}
}
//把剩余字母表从chs.size()开始,补齐映射
int si=chs.size();
for(int i=0;i<26;i++){
if(!chs.contains((char)('a'+i))){
char temp=(char)('a'+si++);
mp.put(temp,(char)('a'+i));
}
}
//对明文word字符逐个查找映射并输出
for(char i:word.toCharArray()){
System.out.print(mp.get(i));
}
// System.out.print(mp.size());
System.out.print("\n");
}
}
}