refactor 01/02

This commit is contained in:
Markus Dieckmann 2023-12-04 11:28:12 +01:00
parent ca7dd3dad3
commit d126d69669

View File

@ -9,15 +9,14 @@ fn main() {
fn process(input: &str) -> i32 {
let lines: i32 = input
.lines()
.into_iter()
.map(|x| replacer(x))
.map(replacer)
.map(|line| {
println!("{line}");
let line_vec = line
.chars()
.filter(|c| c.is_digit(10))
.filter(|c| c.is_ascii_digit())
.collect::<Vec<char>>();
let first = line_vec.clone().into_iter().nth(0);
let first = line_vec.clone().into_iter().next();
let last = line_vec.clone().into_iter().nth_back(0);
[first.unwrap(), last.unwrap()].into_iter().collect()
})