package qhs;
import java.util.Scanner;
public class JiaM {
public static void main(String[] args) {
String[] A = new String[5000];
String min;
String mi;
//String sf;
int cs;
String Q="";
Scanner s = new Scanner(System.in);
//System.out.println("加密请输入 \'y\',解密请输入\'n\'");
//sf = s.nextLine();
System.out.println("请输入要加密的字符(英文)");
min = s.nextLine();
System.out.println("请输入要加密的次数");
cs = s.nextInt();
//往数组里放元素
for (int i = 0; i < min.length(); i++) {
char B = min.charAt(i);
//System.out.println(B);
A[i] = B + "";
}
for(int q=0;q<=cs;q++) { //外循环控制重复加密的次数
System.out.print("第"+q+"次");
for (int x = 0; x < min.length(); x++) { //内循环进行逐字符加密
switch (A[x]) { //加密算法
case " ":
A[x] = " ";
break;
case ",":
A[x] = ",";
break;
case ".":
A[x] = ".";
break;
case "a":
A[x] = "d";
break;
case "b":
A[x] = "f";
break;
case "c":
A[x] = "h";
break;
case "d":
A[x] = "j";
break;
case "e":
A[x] = "l";
break;
case "f":
A[x] = "n";
break;
case "g":
A[x] = "p";
break;
case "h":
A[x] = "r";
break;
case "i":
A[x] = "t";
break;
case "j":
A[x] = "v";
break;
case "k":
A[x] = "x";
break;
case "l":
A[x] = "z";
break;
case "m":
A[x] = "b";
break;
case "n":
A[x] = "e";
break;
case "o":
A[x] = "g";
break;
case "p":
A[x] = "i";
break;
case "q":
A[x] = "k";
break;
case "r":
A[x] = "m";
break;
case "s":
A[x] = "o";
break;
case "t":
A[x] = "q";
break;
case "u":
A[x] = "s";
break;
case "v":
A[x] = "w";
break;
case "w":
A[x] = "u";
break;
case "x":
A[x] = "y";
break;
case "y":
A[x] = "a";
break;
case "z":
A[x] = "c";
break;
}
}
for (int x = 0; x < min.length(); x++) {
System.out.print(A[x]);
}
System.out.println("");
}
}
}