dp解,简单直接

import java.util.*;
public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            while (sc.hasNextLine()) {
                String str = sc.nextLine();
                int len = str.length();
                int[] dp = new int[len+1];
                int res = 0;
                for (int i =1; i <= len; i++) {
                    char tmp = str.charAt(i-1);
                    if (tmp >= '0' && tmp <= '9') {
                        dp[i] = dp[i-1] +1; 
                        res = Math.max(res, dp[i]);
                    }
                }
                
                for (int i =1; i<= len; i++) {
                    if (dp[i] == res) {
                        System.out.print(str.substring(i - res, i));
                    }
                }
                System.out.println("," + res);
            }
        }
}