1
0
Fork 0

cargo fmt

main
Andrew Coleman 2022-12-05 09:59:07 -05:00
parent 14b0294282
commit 408a690061
1 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
use anyhow::Result;
use std::fs;
use std::collections::HashSet;
use std::fs;
fn get_priority(t: &char) -> u32 {
if t.is_ascii_uppercase() {
@ -47,14 +47,20 @@ pub fn run() -> Result<()> {
let elf2map: HashSet<char> = HashSet::from_iter(elf2.chars());
let elf3map: HashSet<char> = HashSet::from_iter(elf3.chars());
for dupe in elf1map.iter().filter(|t| elf2map.contains(t) && elf3map.contains(t)) {
for dupe in elf1map
.iter()
.filter(|t| elf2map.contains(t) && elf3map.contains(t))
{
rucksacks2.push(get_priority(dupe));
}
} else {
break;
}
}
println!("part two priorities {}", rucksacks2.into_iter().sum::<u32>());
println!(
"part two priorities {}",
rucksacks2.into_iter().sum::<u32>()
);
Ok(())
}