解题思路:模拟,遍历

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = "";
        while ((s = br.readLine()) != null) {
            StringBuilder sb = new StringBuilder();
            int index = 0;
            while (index < s.length()) {
                if (Character.isDigit(s.charAt(index))) {
                    sb.append('*');
                    while (index < s.length() && Character.isDigit(s.charAt(index))) {
                        sb.append(s.charAt(index));
                        index++;
                    }
                    sb.append('*');
                } else {
                    sb.append(s.charAt(index));
                    index++;
                }
            }
            System.out.println(sb.toString());
        }
        br.close();
    }
}