use std::fs; fn main() { let contents = fs::read_to_string("input.txt") .expect("Expected to open the file"); let splitted_content : std::str::Lines = contents.lines(); //DONE: Split string lines //DONE: get the values from each column //TODO: calculate the distance between the columns //TODO: sum the distances println!("With text:\n{contents}"); //println!("\n{splittedContent:?}"); let numbers:Vec<(i32,i32)> = splitted_content //.lines() //.into_iter() .filter_map(|x| { let mut nums = x.split_whitespace().filter_map(|i| i.parse::().ok()); Some ((nums.next()?,nums.next()?)) }) //; .collect(); for number in numbers { println!("\n number -> {number:?}"); } /*for line in splitted_content { for word in line.split_whitespace() { let x = word.parse::().unwrap(); let y = x.to_string(); println!("Word: {word} -> {y}"); } }*/ }