Created
August 19, 2021 13:26
-
-
Save sadraskol/57d7d250f9151a94f758a0634e190dd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fs; | |
use std::collections::HashSet; | |
fn list_to_set(s: &str) -> HashSet<String> { | |
let mut recup_nums = HashSet::new(); | |
let mut acc = String::from(""); | |
for c in s.chars() { | |
if c.is_numeric() { | |
acc.push(c); | |
} else if !acc.is_empty() { | |
recup_nums.insert(acc); | |
acc = String::from(""); | |
} | |
} | |
recup_nums | |
} | |
fn main() { | |
let recup = fs::read_to_string("recup.txt") | |
.expect("read recup"); | |
println!("len: {}", recup.len()); | |
let recup_set = list_to_set(&recup); | |
let repoussoir = fs::read_to_string("base-repoussoir_1_21.csv") | |
.expect("read base repoussoir"); | |
println!("len: {}", repoussoir.len()); | |
let repoussoir_set = list_to_set(&repoussoir); | |
for num in recup_set.difference(&repoussoir_set) { | |
println!("num {:?}", num); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment