Rank the kits
A model-kit shop lists kits by size, customizes kits from a template and ranks kits largest first.
What needs to change
Repair Kit’s Ord so the ranking lists every kit once, largest first.
Reproduce
- Compile with rustc --edition=2024 main.rs -o main, pipe the sample kits into ./main and compare the ranking with the expected stdout.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The file contains its imports, read_lines, Kit with its PartialOrd and the complete main, which inserts each kit into a BTreeSet.
Input: up to 50 "code pieces" records, one per line, with fields separated by Unicode whitespace; codes are opaque valid UTF-8 tokens and counts are decimal whole values 0..10000. A kit is the complete (code, pieces) pair: a repeated pair appears once, while one code with different counts denotes distinct kits. Ties use Rust string order. The supplied reader receives valid data.