using System;
using System.Collections.Generic;
using System.Text;

namespace HJ92
{
    internal class Program
    {
        static void Main(string[] args)
        {

            List<string> list = new List<string>();

            while (true)
            {
                var inputStr = Console.ReadLine();
                if (string.IsNullOrEmpty(inputStr))
                {
                    break;
                }
                list.Add(GetMaxNumberCount(inputStr));
            }

            foreach (var item in list)
            {
                Console.WriteLine(item);
            }

        }

        private static string GetMaxNumberCount(string s)
        {
            int max = 0;

            List<string> list = new List<string>();

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < s.Length; i++)
            {
                if (char.IsDigit(s[i]))
                {
                    sb.Append(s[i]);
                    continue;
                }
                if (sb.Length > 0)
                {
                    if (sb.Length > max)
                    {
                        max = sb.Length;
                    }
                    list.Add(sb.ToString());
                    sb.Clear();
                }
            }

            if (sb.Length > 0)
            {
                if (sb.Length > max)
                {
                    max = sb.Length;
                }
                list.Add(sb.ToString());
                sb.Clear();
            }

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Length == max)
                {
                    sb.Append(list[i]);
                }
                if (i == list.Count - 1)
                {
                    sb.Append(',');
                    sb.Append(max);
                }
            }
            return sb.ToString();
        }
    }
}