import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringWriter; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author cteam66 */ public class vigenere { public static String vig(String encode, String ret) { String code = ""; int pomKey = 0; for(int i = 0; i < ret.length(); i++ ) { //System.out.println("Pismeno :" + ret.charAt(i)); //System.out.println("Kod: "+encode.charAt(pomKey)); int pozice = (int) ret.charAt(i); int codeS = (int) encode.charAt(pomKey); pozice = pozice + (codeS - 65) + 1; if(pozice > 90) { pozice = 65 + (pozice - 91); } code += (char) pozice; //System.out.println(pozice + "(pismeno "+(char) pozice); pomKey++; if(pomKey >= encode.length()) pomKey = 0; } return code; } public static void main(String [] args) throws IOException { // System.out.print((int) 'A'+""); StringWriter sw = new StringWriter(); BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in)); String line = bfr.readLine(); while(!line.equals("0")) { String text = bfr.readLine(); sw.append(vig(line, text)+"\n"); line = bfr.readLine(); } System.out.print(sw); } }