import sys

for line in sys.stdin:
    d = dict()
    cnt, max_cnt = 0, 0
    s = ""
    for ch in line:
        if ch.isdigit():
            cnt += 1
            s += ch
            max_cnt = max(cnt, max_cnt)
        else:
            d[s] = cnt
            cnt = 0
            s = ""
    for s in d:
        if d[s] == max_cnt:
            print(s, end="")
    print("," + str(max_cnt))