
import java.util.*;
import java.lang.*;
import java.io.*;

class Ideone {
	public static void main (String[] args) throws java.lang.Exception {
		Scanner scanner = new Scanner(System.in);
		String message, cipher;
		message = scanner.nextLine();
		cipher = scanner.nextLine();
		char[] decoded = new char [message.length()];
 
		for (int i = 0; i < message.length(); i++) {
			if (message.charAt(i) == ' ') {
				decoded[i] = ' ';
			} else {
				decoded[i] = cipher.charAt(findIndex(message.charAt(i)));
			}			
		}
		System.out.println(decoded);
	}
	
	static int findIndex(char c) {
        String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for (int i = 0; i < alphabet.length(); i++) {
            if (c == alphabet.charAt(i))
                return i;
        }
        return -1;
    }
}