/*
template   Dwite_IN_out_java.java
*/
import java.io.*;
import java.util.*;

class Dwite {
  public static void main (String [] args) throws IOException {
	String s= "";
	String[] get;
	String[] out;
boolean bln = true;
	int start = 0;
char temp=' ';
	String cnt = "";
	int count = 0;
	int get1 = 5;
	int out1 = 5;
	get = new String[get1];
	out = new String[out1];
    // Use BufferedReader rather than RandomAccessFile; it's much faster
    BufferedReader f = new BufferedReader(new FileReader("DATA1.txt"));
                                                  // input file name goes above
    PrintWriter out2 = new PrintWriter(new BufferedWriter(new FileWriter("OUT1.txt")));
	
	for(int i= 0; i <get1; i ++){
	count = 0;cnt = "";s= "";temp=' ';bln = true;
		s = f.readLine();
		//int fr_num = Integer.parseInt(s);
		get[i] = s;    
		for (int j = 0; j <get.length; j++){
			if((int)(get[i].charAt(j)) >=48 && (int)(get[i].charAt(j)) <=57){
				cnt = cnt + get[i].charAt(j);
			}

		}
		count = Integer.parseInt(cnt);
		for (int j = 0; j <s.length(); j++){
			if((int)(get[i].charAt(j)) >=48 && (int)(get[i].charAt(j)) <=57){
				start = j;
				break;
			}
		}
		System.out.println(start + " " + count);
		out[i] = "";
		for (int j = 0; j <s.length(); j++){
			if((int)(get[i].charAt(j)) >=65 && (int)(get[i].charAt(j)) <=90){
				if((int)(get[i].charAt(j)) - count <65){
					temp = (char)(90 - (65 - ((int)(get[i].charAt(j)) - count))+ 1);
				}
				else{
					temp = (char)((int)(get[i].charAt(j))- count);
				}

				//System.out.print(temp);
				out[i] = (out[i] + temp + "");
			}
			else if((int)(get[i].charAt(j)) >=48 && (int)(get[i].charAt(j)) <=57){
				if (bln == true){
							out[i] = (out[i] + count + " ");
							bln = false;
				}
							
			}

		}


	}
  //  int fr_num = Integer.parseInt(s);
 // out 
	for(int i= 0; i <get1; i ++){
		out2.write(""+  out[i]  + "\n" );  // gets entire line
	}
    


    f.close();
    out2.close();                                  // close the output file
    System.exit(0);                               // don't omit this!

  
   } // end main




}//end class
