AC代码:
import java.util.Scanner; /** * @author CC11001100 */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextLine()){ System.out.println(decode(sc.nextLine())); } } private static String decode(String s){ StringBuilder res = new StringBuilder(); for(int i=0; i<s.length(); i++){ char c = s.charAt(i); if(Character.isDigit(c)){ res.append(c); } } return res.toString(); } }