题解 | #字符串中找出连续最长的数字串#
字符串中找出连续最长的数字串
http://www.nowcoder.com/practice/bd891093881d4ddf9e56e7cc8416562d
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String[] split = s.split("[^0-9]");
String tmp = "";
for (int i = 0; i < split.length; i++){
if (tmp.length() < split[i].length()){
tmp = split[i];
}
}
System.out.println(tmp);
}
}
查看19道真题和解析