<

Challenge 2

User Image Log-in
with Discord

Part One:
What a Mess!

You wake, ready to start a new day. Your holographic tablet dings, displaying a message:

Rise and shine, Cadet! Due to your exemplary performance in the Comms Bay, we are assigning you to the Electrical Control Room. Report there at 0800 hours.

When you arrive, the room is in chaos. The crew are grabbing at piles of loose paper, which completely cover the floor. The pages seem to be from an instruction manual of sorts. Someone sees you standing there and tells you to grab some paper and sort them, leaving before you can ask any questions. You grab a pile.

The sheets of printed paper do not have page numbers, but they all have a header printed at the top:

Section Title, Chapter Number, Subchapter Letter, Section Number

Your puzzle input is a TXT file with the each page's header on individual lines. You decide to sort the pages like any book — first by chapter, then by subchapter, then by section. Each category sorted in ascending order. Chapter number and section number should be sorted as integers, not strings.

When everyone is done sorting their piles, you assume you will have to work together to combine all your piles into one, so you decide to create a mnemonic out of the first letters of the sorted Section Titles to help you contribute to this collaboration.

For example:

If your pages are

title,chapter,subchapter,section
Cosmos,2,J,3
Planets,2,A,9
Exploration,3,Y,2
Stars,1,X,4
Astronauts,2,J,1

You would sort them first by Chapter Number, then by Subchapter Letter, and finally by Section Number to get

["Stars", "1", "X", "4"]
["Planets", "2", "A", "9"]
["Astronauts", "2", "J", "1"]
["Cosmos", "2", "J", "3"]
["Exploration", "3", "Y", "2"]

And the first letters of the Section Titles would spell out "SPACE".

The rest of the crew are almost done. You should quickly sort your pile of pages.

Your pages are: