24 lines
685 B
Rust
24 lines
685 B
Rust
|
fn parser(content: &str) {
|
||
|
let output = content
|
||
|
.lines()
|
||
|
.filter(|item| !item.starts_with("move"))
|
||
|
.flat_map(|line| {
|
||
|
let splitted = line
|
||
|
.trim()
|
||
|
.split(' ')
|
||
|
.enumerate()
|
||
|
.filter(|item| !item.1.contains(' '))
|
||
|
.filter(|item| !item.1.is_empty())
|
||
|
.collect::<Vec<(usize, &str)>>();
|
||
|
println!("{splitted:?}");
|
||
|
splitted
|
||
|
})
|
||
|
.collect::<Vec<(usize, &str)>>();
|
||
|
}
|
||
|
|
||
|
pub fn solve(file_path: &str) -> i32 {
|
||
|
let content = std::fs::read_to_string(file_path).expect("Please provide a file.");
|
||
|
parser(&content);
|
||
|
0
|
||
|
}
|