看我写的简单有效的屎山代码
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
char c[] = str.toCharArray();
for(int i = 0; i<str.length() ; i++){
if(c[i]>='A'&&c[i]<='Z'){
if(c[i]+32 != 'z')
c[i] += 33;
else
c[i] = 'a';
}
else if(c[i]=='a'||c[i]=='b'||c[i]=='c')
c[i]='2';
else if(c[i]=='d'||c[i]=='e'||c[i]=='f')
c[i]='3';
else if(c[i]=='g'||c[i]=='h'||c[i]=='i')
c[i]='4';
else if(c[i]=='j'||c[i]=='k'||c[i]=='l')
c[i]='5';
else if(c[i]=='m'||c[i]=='n'||c[i]=='o')
c[i]='6';
else if(c[i]=='p'||c[i]=='q'||c[i]=='r'||c[i]=='s')
c[i]='7';
else if(c[i]=='t'||c[i]=='u'||c[i]=='v')
c[i]='8';
else if(c[i]=='w'||c[i]=='x'||c[i]=='y'||c[i]=='z')
c[i]='9';
System.out.print(c[i]);
}
System.out.println();
}
}