Part One:
Pharma-geddon
After the past few days of high-tension work in other areas of the ship, you put in a request for a more laid-back task. Helping to organize the inventory in the Sick Bay sounds like a great, mindless task that you can relax by doing.
As seems to be your usual misfortune, you arrive to yet another tableau of stress and confusion. The medical officer has just put in an order for some medical supplies, but someone has lost the reference sheet for the inventory. Without the four-symbol code for each item, you cannot retrieve the order from the auto-vending storage.
The only files that are found are an inventory, listing the name and quantity of each supply, and a raw data file, your puzzle input, that stores the entire collections of medical supplies. As these items were entered into the ship's inventory, in no particular order, their four-symbol codes were concatenated onto the raw data file with no delimiter.
You are asked if you know of any Counter that can process this raw data file and tell you the number of appearances of all the four-symbol codes. Then you can cross-check it with the inventory.
Using the raw data file, find each four-symbol code that appears the number of times corresponding to each item's quantity. Print these codes next to each other without any spaces to retrieve them from the storage.
For example:
If your raw data file looks like **_#@$%&()[]#?!)()[]#?!)()[]()[]@$%&@$%&()[]()[]()[]()[]@$%&@$%&#?!)**_#**_#@$%&#?!) We can see
- 8 occurrences of ()[]
- 6 occurrences of @$%&
- 4 occurrences of #?!)
- 3 occurrences of **_#
If the inventory tells you there are 8 hypodermic needles and 4 plaster casts, You can determine from your count that the four-symbol code for hypodermic needles is ()[] and the four-symbol code for plaster casts is #?!).
To get these items from the storage, you will input ()[]#?!).
The medical officer has requested bandages, healing serum, and antacids.
According to the inventory, there are:
•
1081
packages of standard adhesive bandages
•
1055
vials of
"InstaHeal" disinfectant and wound
closure serum
•
965
blister packs
of "Yucky Tummy No More" chewable antacids
Raw data file: