import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) { 
            String str = in.nextLine();
		  //用非数字部分分割字符串得到数字字符串数组
            String[] arr = str.split("[^0-9]+");
		  //获取最长字符串长度
            int max = Arrays.stream(arr).mapToInt(p->p.length()).max().orElse(0);
            String str2 = "";
		  //拼接符合条件的数字字符串
            for(String s : arr){
                if(s.length()==max){
                    str2 += s;
                }
            }
            System.out.println(str2+","+max);
        }
    }
}