题解 | #表示数字#
表示数字
http://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=null;
while((s=br.readLine())!=null){
char[] chars=s.toCharArray();
StringBuilder sb=new StringBuilder();
for(int i=0;i<chars.length;i++){
int count=0;
if(chars[i]>='0'&&chars[i]<='9'){
while(i<chars.length && chars[i]>='0'&&chars[i]<='9'&&i<chars.length){
if(count==0){
sb.append('*');
sb.append(chars[i]);
count++;
}
else{
sb.append(chars[i]);
}
i++;
}
sb.append("*");
}
if(i<chars.length)
sb.append(chars[i]);
}
System.out.println(sb);
}
}
}