import java.util.Scanner;
public class Main001 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
//用非数字字符分隔
String[] s = str.split("[^0-9]+");
System.out.println();
if (s.length > 0 && str.length() > 0) {
String max = s[0];
for (int i = 1; i < s.length; i++) {
if (max.length() < s[i].length()) {
max = s[i];
}
}
System.out.print(max + "," + max.length());
} else {
System.out.println(0);
}
}
}
在字符串中找出连续最长的数字串
最新推荐文章于 2023-07-26 11:52:31 发布