#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main(){
    string s;
    while(cin >> s){
        string ans,temp;
        int length = 0, max_length = 0;
        for(int i = 0; i<s.size(); i++){
            if(s[i] >= '0' && s[i] <= '9'){
               length ++;
               temp += s[i];
            }
            if(s[i] < '0' || s[i] > '9' || i == s.size()-1){//非数字或最后一个字符
                if(length > max_length){
                    max_length = length;
                    ans = temp;//起到清空+放入新字符串的作用
                }
                else if(length == max_length){
                    ans += temp;
                }
                length = 0; 
                temp = "";
            }
        }
        cout << ans  << "," << max_length << endl;
    } 
}