let str;
while(str = readline()){
  let res = str.match(/\d+/g);
  let max = 0;
  for(let v of res){
    if(v.length>max){
      max = v.length;
    }
  }
  let resStr = ''
  for(let v of res){
    if(v.length == max){
      resStr +=v
    }
  }
  console.log(resStr+','+max)
}