I doubt you actually researched it but here's some pseudo-code for you anyways:
Code:
current_group = null
max_number = 0
file = open('/google/me/input.txt','r')
for line in file:
if line is a number and > max_number then set as max_number
if line is a word (any check will do, a simple regex ^\w+ for example) and current_group = null then current_group = word
else output current_group,max_number to where ever you need set current_group = word max_number = 0 and call method again
Basic idea, I'd write something more elegant with this only as the foundation if you're turning it in for a grade though.