rustfmt
This commit is contained in:
@ -4,8 +4,7 @@ fn char_to_prio(c: char) -> u64 {
|
||||
if c.is_ascii_uppercase() {
|
||||
let ci = c as u8;
|
||||
return u64::from(ci - b'A' + 27);
|
||||
}
|
||||
else if c.is_ascii_lowercase() {
|
||||
} else if c.is_ascii_lowercase() {
|
||||
let ci = c as u8;
|
||||
return u64::from(ci - b'a' + 1);
|
||||
}
|
||||
@ -23,7 +22,7 @@ fn main() {
|
||||
|
||||
let items: HashSet<char> = HashSet::from_iter(compartments.0.chars());
|
||||
let mut new_items: HashSet<char> = HashSet::new();
|
||||
|
||||
|
||||
for c in compartments.1.chars() {
|
||||
if new_items.insert(c) && items.contains(&c) {
|
||||
priority_sum += char_to_prio(c);
|
||||
@ -36,7 +35,11 @@ fn main() {
|
||||
let mut input = INPUT.lines().peekable();
|
||||
priority_sum = 0;
|
||||
while input.peek().is_some() {
|
||||
let lines = [input.next().unwrap().clone(), input.next().unwrap().clone(), input.next().unwrap().clone()];
|
||||
let lines = [
|
||||
input.next().unwrap().clone(),
|
||||
input.next().unwrap().clone(),
|
||||
input.next().unwrap().clone(),
|
||||
];
|
||||
|
||||
for c in b'A'..=b'Z' {
|
||||
let c = c as char;
|
||||
|
Reference in New Issue
Block a user