2021 day8/rust: only trim start of output digits

This commit is contained in:
Xiretza 2021-12-09 18:05:40 +01:00
parent 92aba2db95
commit edd8bdfa71

View file

@ -32,7 +32,7 @@ pub fn unscramble(line: &str) -> LineResult {
let digits = parts let digits = parts
.next() .next()
.unwrap() .unwrap()
.trim() .trim_start()
.split(' ') .split(' ')
.map(|s| s.bytes().map(|c| counts[c as usize - b'a' as usize]).sum()) .map(|s| s.bytes().map(|c| counts[c as usize - b'a' as usize]).sum())
.map(|n: usize| FREQ_TABLE[n]) .map(|n: usize| FREQ_TABLE[n])