例如:“12abjhsgf12345”,输出:“12345”
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String str = sc.nextLine();
String[] s = str.split("[^0-9]");
String max = s[0];
if (s.length > 0 && str.length() > 0) {
for (int i = 1; i < s.length; i++) {
if (max.length() < s[i].length()) {
max = s[i];
}
}
System.out.println(max);
}
}
}
}