while True:
    try:
        s = input()
        childs = ""
        for c in s:
            if ord("0") <= ord(c) <= ord("9"):
                childs += c
            else:
                childs += " "
        childs_lst = []
        max_len = 0
        for i in list(childs.strip().split()):
            if max_len < len(str(i)):
                max_len = len(str(i))
                childs_lst.clear()
                childs_lst.append(i)
            elif max_len == len(str(i)):
                childs_lst.append(i)
        # print(childs_lst, max_len)
        print("".join(str(x) for x in childs_lst), max_len, sep=",")

    except:
        break