不吹牛逼,我写的代码真是又臭又烂
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
String str1 = scan.nextLine();
String str2 = scan.nextLine();
List<Character> list = new ArrayList<>();
List<Character> list1 = new ArrayList<>();
for(char c : str1.toCharArray()){
if(String.valueOf(c).matches("[a-y]")){
c = Character.toUpperCase(c);//要有参数来接收!!!
c = (char)((int)c + 1);
list.add(c);
}
else if(String.valueOf(c).matches("[z]")){
c = 'A';
list.add(c);
}
else if(String.valueOf(c).matches("[A-Y]")){
c = Character.toLowerCase(c);
c = (char)((int)c + 1);
list.add(c);
}
else if(String.valueOf(c).matches("[Z]")){
c = 'a';
list.add(c);
}
else if(String.valueOf(c).matches("[0-8]")){
c = (char)((int)c+1);
list.add(c);
}
else if(String.valueOf(c).matches("[9]")){
c = '0';
list.add(c);
}
}
for(int i = 0; i<list.size(); i++){
System.out.print(list.get(i));
}
System.out.println("");
for(char c : str2.toCharArray()){
if(String.valueOf(c).matches("[B-Z]")){
c = Character.toLowerCase(c);
c = (char)((int)c - 1);
list1.add(c);
}
else if(String.valueOf(c).matches("[A]")){
c = 'z';
list1.add(c);
}
else if(String.valueOf(c).matches("[b-z]")){
c = Character.toUpperCase(c);
c = (char)((int)c - 1);
list1.add(c);
}
else if(String.valueOf(c).matches("[a]")){
c = 'Z';
list1.add(c);
}
else if(String.valueOf(c).matches("[1-9]")){
c = (char)((int)c-1);
list1.add(c);
}
else if(String.valueOf(c).matches("[0]")){
c = '9';
list1.add(c);
}
}
for(int i = 0; i<list1.size(); i++){
System.out.print(list1.get(i));
}
System.out.println("");
}
scan.close();
}
}