while True: try: s = input() lens = 0 out = '' for i in s: if not i.isdigit(): #print(i) s = s.replace(i, '') s_list = s.split('') for i in s_list: if len(i) > 0 and len(i) > lens: out = i lens = len(i) if len(i) > 0 and len(i) == lens and i not in out: out += i print(out,lens,sep=',') except: break