USING: io.encodings.ascii io.files kernel math.parser math.statistics prettyprint sequences splitting ; "input.txt" ascii file-lines ! Read the input file as a sequence of lines. [ dec> ] map { f } split [ sum ] map ! Parse as a list of total calories for each elf. { 0 1 2 } kth-largests ! Find the three largest. More efficient than sorting. [ first . ] ! The largest; part 1. [ sum . ] bi ! Sum of the three largest; part 2.