Slightly more elegant
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| use std::iter::zip; | use std::iter::zip; | ||||||
|  |  | ||||||
| const WORD_LIST: [&str; 9] = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]; | 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 { | fn find_first_digit(line: &str) -> u32 { | ||||||
|     match line.chars().find(|character| { character.is_digit(10) }) { |     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 { | pub fn part2(input: &str) -> String { | ||||||
|     let parsed_inputs = &replace_with_digits(input); |     let parsed_inputs = &replace_with_digits(input); | ||||||
|     dbg!(parsed_inputs); |  | ||||||
|     part1(parsed_inputs) |     part1(parsed_inputs) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Connor Johnstone
					Connor Johnstone