import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine().toLowerCase();
String newStr = str.replaceAll("([0-9]+)", "*$1");
String newStr1 = newStr.replaceAll("([a-z])", "");
String[] array = newStr1.split("\\*");
int maxLength = 0;
for (String s : array) {
if (s.length() > maxLength) {
maxLength = s.length();
}
}
StringBuilder stringBuilder = new StringBuilder();
for (String s : array) {
if(s.length()==maxLength){
stringBuilder.append(s);
}
}
stringBuilder.append(",");
stringBuilder.append(maxLength);
System.out.println(stringBuilder.toString());
}
}