import java.util.ArrayList; import java.util.List; import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext()) {
        String str = sc.nextLine();
        List<String> list = new ArrayList<>();
        int max = findMaxDig(str, list);
        StringBuilder sb = new StringBuilder();
        for (String string : list) {
            if (string.length() == max) {
                sb.append(string);
            }
        }
        System.out.println(sb.toString() + "," + max);
    }
}

private static int findMaxDig(String str, List<String> list) {
    int i = 0;
    StringBuilder string = new StringBuilder();
    int max = 0;
    while (i < str.length()) {
        if (Character.isDigit(str.charAt(i))) {
            string.append(str.charAt(i));
        } else {
            if (string.length() > 0) {
                list.add(new String(string.toString()));
                max = Math.max(max, string.length());
                string.setLength(0);
            }
        }
        i++;
    }
    if (string.length() > 0) {
        list.add(string.toString());
        max = Math.max(max, string.length());
        string.setLength(0);
    }
    return max;
}

}