while True:
    try:
        line = list(input())
        for i in range(len(line)):
            if not line[i].isnumeric():
                line[i] = ' '
            else:
                continue
        list1 = (''.join(line)).split(' ')
        l = 0
        list2 = []
        for i in list1:
            if len(i) > l:
                l = len(i)
        for i in list1:
            if len(i) == l:
                list2.append(i)
            else:
                continue
        print(''.join(list2)+','+str(l))
    except:
        break