#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string s;
vector<pair<int,string>> res; // 存放长度 + 数字字符串
if(cin>>s){
string current_str;
for(int i = 0; i <s.length(); ++i){
if(isdigit(s[i])){
// 如果是数字加入到新的字符串当中
current_str += s[i];
}else{
// 不是数字
if(!current_str.empty()){
res.push_back({current_str.length(),current_str});
current_str.clear();
}
}
}
// 处理末尾是连续的字符串的情况
if(!current_str.empty()){
res.push_back({current_str.length(),current_str});
}
// 对前面几个进行输出
if(res.empty()){
// 为空的情况,即没有数字的情况
cout<<'0'<<endl;
return 0;
}
// 先找最大的长度
int max_len = 0;
for(auto &[length,str]: res){
if(length > max_len){
max_len = length;
}
}
for(auto &[length,str]:res){
if(length == max_len){
cout<<str;
}
}
cout<<","<<max_len<<endl;
}
return 0;
}