# 复习了replace函数在string中的用法
while True:
    try:
        s=input()

        for x in s:
            if not x.isdigit():
                s = s.replace(x, " ")
        s = s.split()
             
        max_flag = 0
        res = ""
        for c in s:
            if len(c)>max_flag:
                max_flag = len(c)
        for c in s:
            if len(c)==max_flag:
                res = res+c
        print(str(res)+','+str(max_flag))
    except:
        break