Split with two different seperators instead of replacing first
This commit is contained in:
@@ -75,8 +75,7 @@ fn overlaps((a, b): &(Elf, Elf)) -> bool {
|
|||||||
// Transform from line to pair of Elfs
|
// Transform from line to pair of Elfs
|
||||||
fn transform(s: &str) -> (Elf, Elf) {
|
fn transform(s: &str) -> (Elf, Elf) {
|
||||||
let transformed = s
|
let transformed = s
|
||||||
.replace("-", ",")
|
.split([',', '-'])
|
||||||
.split(',')
|
|
||||||
.flat_map(|value| value.parse::<u32>())
|
.flat_map(|value| value.parse::<u32>())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user