//简单明了,运行时间12ms
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String s=null;
        while((s=br.readLine())!=null){
            char[] chars=s.toCharArray();
            int count=0;
            int max=0;
            StringBuilder sb=new StringBuilder();
            for(int i=0;i<chars.length;i++){
                if(chars[i]>='0'&&chars[i]<='9'){
                    count++;
                    if(max<=count) {
                        if(max<count) sb.delete(0,sb.length());
                        max=count;
                    }
                }else {
                    if(max==count)
                    for(int j=i-max;j<i;j++){
                            sb.append(chars[j]);
                        }
                    count=0;
                }
            }
            if(max==count){
                for(int j=chars.length-max;j<chars.length;j++){
                    sb.append(chars[j]);
                }
            }
            System.out.println(sb+","+max);
        }
    }
}