while True:
    try:
        s = input()
        res = ''
        max_length = 0
        i = 0
        while i < len(s):
            start = i
            while i < len(s) and s[i].isdigit():
                i += 1
            if i - start > max_length: 
            #当前长度大于此前求出的最长长度,修改长度和子串
                max_length = i - start
                res = s[start:i]
            elif i - start == max_length and max_length > 0:
            #当前长度等于此前求出的最长长度,在已有子串结果后加上当前得到的子串
                res += s[start:i]
            i += 1
        print(res, max_length, sep = ',')
    except:
        break