From edd8bdfa7157db8f4aa9c75dd7b07dd4ccc4e178 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Thu, 9 Dec 2021 18:05:40 +0100 Subject: [PATCH] 2021 day8/rust: only trim start of output digits --- 2021/day8/day8_rs/src/v2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2021/day8/day8_rs/src/v2.rs b/2021/day8/day8_rs/src/v2.rs index df958d1..735b4ac 100644 --- a/2021/day8/day8_rs/src/v2.rs +++ b/2021/day8/day8_rs/src/v2.rs @@ -32,7 +32,7 @@ pub fn unscramble(line: &str) -> LineResult { let digits = parts .next() .unwrap() - .trim() + .trim_start() .split(' ') .map(|s| s.bytes().map(|c| counts[c as usize - b'a' as usize]).sum()) .map(|n: usize| FREQ_TABLE[n])