refactoring 01/01

This commit is contained in:
Markus Dieckmann 2023-12-04 11:26:45 +01:00
parent 513448bbbd
commit ca7dd3dad3

View File

@ -7,13 +7,12 @@ fn main() {
fn process(input: &str) -> i32 {
let lines: i32 = input
.lines()
.into_iter()
.map(|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()
})