Day 3: Rucksack Reorganization

Day 3 involves finding common items in rucksacks and determining their priorities.

Problem Overview

Elves packed their rucksacks incorrectly, and you need to help them find the misplaced items. Each rucksack has two compartments, and items of the same type should go in the same compartment. Your tasks:

  1. Find items that appear in both compartments of each rucksack
  2. Find badges (items common to each group of three elves)
  3. Calculate the sum of priorities for these items

Each item type is identified by a single letter (case-sensitive) and has a priority value:

  • Lowercase letters (a-z) have priorities 1-26
  • Uppercase letters (A-Z) have priorities 27-52