From 62ae6f8690f679613b126a067a0e764136270642 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Fri, 6 Dec 2024 13:46:18 +0000 Subject: [PATCH] refactor: programmatically remove the first unwanted " in problem 42 --- src/bin/coded_triangle_numbers.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/coded_triangle_numbers.rs b/src/bin/coded_triangle_numbers.rs index 2b9c1cf..b6e81db 100644 --- a/src/bin/coded_triangle_numbers.rs +++ b/src/bin/coded_triangle_numbers.rs @@ -8,8 +8,11 @@ fn main() { 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", ""); + if contents.len() > 0 { + contents.remove(0); + } let words = contents.split("\",\"").collect::>(); let mut triangles = 0;