while True:
    
    try:
        sub_str = []
        max_len = 0
        str_input = input()
        for i in range(len(str_input)):
            for j in range(i + 1, len(str_input) + 1):
                if str_input[i: j].isdecimal() and len(str_input[i: j]) >= max_len:
                    sub_str.append(str_input[i: j])
                    max_len = len(str_input[i: j])
        result = ''
        for each in sub_str:
            if len(each) == max_len:
                result += each
        print(result + ',' + str(max_len))
                
    except:
        break