这种写法你绝对见不到第二个!!!
绝对的屎山!!!
import java.util.*;
import java.util.regex.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
List<Character> list = new ArrayList<Character>();
while(scan.hasNext()){
String str = scan.nextLine();
char[] ch = str.toCharArray();
char ccc = '*';
for(char c : ch){
int size = list.size();
if(size == 0 && String.valueOf(c).matches("[0-9]")){
list.add(ccc);
list.add(c);
continue;
}
else if(size == 0){
list.add(c);
continue;
}
if(String.valueOf(c).matches("[^0-9]")&&String.valueOf(list.get(size-1)).matches("[0-9]")){
list.add(ccc);
list.add(c);
}
else if(String.valueOf(c).matches("[^0-9]")&&String.valueOf(list.get(size-1)).matches("[^0-9]")){
list.add(c);
}
if(String.valueOf(c).matches("[0-9]")&&String.valueOf(list.get(size-1)).matches("[^0-9]")){
list.add(ccc);
list.add(c);
}
else if(String.valueOf(c).matches("[0-9]")&&String.valueOf(list.get(size-1)).matches("[0-9]")){
list.add(c);
}
}
if(String.valueOf(list.get(list.size()-1)).matches("[0-9]")){
list.add(ccc);
}
for(char c : list){
System.out.print(c);
}
}
}
}