input = STDIN.read.split "\n\n" elves = input.map { |elf| elf.split("\n").map(&:to_i).sum } puts "Part 1: #{elves.max}" puts "Part 2: #{elves.sort.last(3).sum}"