refactor: programmatically remove the first unwanted " in problem 42

This commit is contained in:
Muhammad Nauman Raza 2024-12-06 13:46:18 +00:00
parent 93c73bb132
commit 62ae6f8690
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -8,8 +8,11 @@ fn main() {
characters.push(c); characters.push(c);
} }
let contents = fs::read_to_string("assets/input") let mut contents = fs::read_to_string("assets/input")
.expect("Could not read the input file").replace("\"\n", ""); .expect("Could not read the input file").replace("\"\n", "");
if contents.len() > 0 {
contents.remove(0);
}
let words = contents.split("\",\"").collect::<Vec<&str>>(); let words = contents.split("\",\"").collect::<Vec<&str>>();
let mut triangles = 0; let mut triangles = 0;