23 lines
686 B
Rust
Executable File
23 lines
686 B
Rust
Executable File
//! # Rucksack Reorganizatio
|
|
//!
|
|
//! Read a file containing a list of items in a set of rucksacks
|
|
//! compute the sum of priorities of items that are in both compartiments
|
|
//! where each sack is divided into two equally sized compartiments
|
|
//!
|
|
//! ## Example
|
|
//! ```bash
|
|
//! cargo run -- ../input.txt # Execute the program with the input file
|
|
//! ```
|
|
|
|
use std::fs;
|
|
use std::env;
|
|
|
|
mod rucksack;
|
|
|
|
fn main() {
|
|
let args: Vec<String> = env::args().collect();
|
|
let filename = &args[1];
|
|
let contents: String = fs::read_to_string(filename)
|
|
.expect("Something went wrong reading the file");
|
|
println!("{}", rucksack::sum_priorities_items_both_compartiments(&contents));
|
|
} |