Slightly more elegant

This commit is contained in:
Connor Johnstone
2023-11-30 23:27:09 -07:00
parent 7bb6e131a4
commit 48bd1e61cb

View File

@@ -1,7 +1,7 @@
use std::iter::zip;
const WORD_LIST: [&str; 9] = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
const DIGIT_LIST: [&str; 9] = ["one1one", "two2two", "three3three", "four4four", "five5five", "six6six", "seven7seven", "eight8eight", "nine9nine"];
const DIGIT_LIST: [&str; 9] = ["o1e", "t2o", "t3e", "f4r", "f5e", "s6x", "s7n", "e8t", "n9e"];
fn find_first_digit(line: &str) -> u32 {
match line.chars().find(|character| { character.is_digit(10) }) {
@@ -39,7 +39,6 @@ pub fn part1(input: &str) -> String {
pub fn part2(input: &str) -> String {
let parsed_inputs = &replace_with_digits(input);
dbg!(parsed_inputs);
part1(parsed_inputs)
}