package oj.test;
import java.util.Scanner;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Demo3 {
/**
* @在字符串中找出连续最长的数字串
* 输出字符串中最长的数字字符串和它的长度。
* 如果数字字符串为空,则只输出0
* 如 input: dadfsaf output:0
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
String[] arr = str.split("[0-9]");
if(str.matches("[0-9]+"))
sop(str+","+str.length());
else
if(arr[0].length()!=str.length()){
count(str);
}else
sop(0);
}
private static void count(String str) {
String regex = "[0-9]+";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
TreeMap<String,Integer> tm = new TreeMap<String,Integer>();
while(m.find()){
//sop(m.group()); //输出截取的目标对象
//sop(m.start()+".........."+m.end()); //输出角标
tm.put(m.group(), m.group().length());
}
Set<Map.Entry<String,Integer>> entrySet = tm.entrySet();
Iterator<Map.Entry<String, Integer>> it = entrySet.iterator();
String max_key="";
int max_value=0;
while(it.hasNext()){
Map.Entry<String, Integer> me = it.next();
String key = me.getKey();
Integer value = me.getValue();
if(value>max_value){
max_value = value;
max_key = key;
}
}
sop(max_key+","+max_value);
}
private static void sop(Object obj) {
System.out.println(obj);
}
}