import java.util.Scanner;
import java.util.regex.Pattern;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextLine()){
char[] password = sc.nextLine().toCharArray();
StringBuilder transformedString = new StringBuilder();
for (int i = 0; i < password.length; i++) {
String str = String.valueOf(password[i]);
if(Pattern.compile("[a-z]").matcher(str).find()){
str = turnLettersIntoNumbers(str);//九键手机键盘上的数字与字母的对应: 1--1, abc--2, def--3, ghi--4, jkl--5, mno--6, pqrs--7, tuv--8 wxyz--9, 0--0,把密码中出现的小写字母都变成九键键盘对应的数字,如:a 变成 2,x 变成 9.
}else if(Pattern.compile("[A-Z]").matcher(str).find()){
//System.out.println("str01="+str);
str = caseConversionAndBackwardOneLetter(str);//而密码中出现的大写字母则变成小写之后往后移一位,如:X ,先变成小写,再往后移一位,变成了 y ,例外:Z 往后移是 a
//System.out.println("str02="+str);
}//数字和其它的符号都不做变换。
transformedString.append(str);
}
System.out.println(transformedString);
}
}
private static String caseConversionAndBackwardOneLetter(String str) {
if(str.equals("Z")){
return "a";
}else {//将String转换成ASCII码,然后加一实现后移一位。再把ASCII码转换成String返回。
str = str.toLowerCase();
char ch = str.charAt(0);//字母的char类型和ASCII码可以相互转换。
int num = ch + 1;//char类型转换成int类型,然后+1,实现后移一位。
ch = (char) num;
str = String.valueOf(ch);
return str;
}
}
private static String turnLettersIntoNumbers(String str) {
if (Pattern.compile("[a-c]").matcher(str).find()) {
return "2";
} else if (Pattern.compile("[d-f]").matcher(str).find()) {
return "3";
} else if (Pattern.compile("[g-i]").matcher(str).find()) {
return "4";
} else if (Pattern.compile("[j-l]").matcher(str).find()) {
return "5";
} else if (Pattern.compile("[m-o]").matcher(str).find()) {
return "6";
} else if (Pattern.compile("[p-s]").matcher(str).find()) {
return "7";
} else if (Pattern.compile("[t-v]").matcher(str).find()) {
return "8";
} else if (Pattern.compile("[w-z]").matcher(str).find()) {
return "9";
}
return str;
}
}