use advent_of_code::strings::{get_numbers, get_string_numbers}; #[allow(unused_imports)] use adventofcode_macros::{include_example, include_example}; include_example!(2023 01); //static DATA: &str; fn main() { let mut sum: u32 = 0; let data: String = DATA.into(); for coordinates in data.split('\n').map(get_numbers) { if coordinates.len() == 0 { continue; } let first = coordinates.first().unwrap() * 10; let last = *coordinates.last().unwrap(); let number = first + last; println!("Number: {}", number); sum += number; } println!("Sum of Numbers {}", sum); sum = 0; for coordinates in data.split('\n').map(get_string_numbers) { if coordinates.len() == 0 { continue; } let first = coordinates.first().unwrap() * 10; let last = *coordinates.last().unwrap(); let number = first + last; println!("Number: {}", number); sum += number; } println!("Sum of Numbers with strings {}", sum); }