while True:
try:

    s=input()
    for i in s:
        if i.isdigit()==False:
            s=s.replace(i," ")
    s=s.split()

    r1=max([len(i) for i in s])
    r2=""

    for i in s:
        if len(i)==r1:
            r2+=i
    print(r2+","+str(r1))

except:
    break