SHARE
TWEET

Untitled

a guest Dec 10th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn seven_get_vec() -> BTreeMap<char, BTreeSet<char>> {
  2.     let mut f = File::open("/home/mark/Downloads/input-7").expect("file not found");
  3.  
  4.     let mut contents = String::new();
  5.     f.read_to_string(&mut contents)
  6.         .expect("something went wrong reading the file");
  7.  
  8.     let mut output = BTreeMap::new();
  9.     for line in contents.lines() {
  10.         let mut c_i = line.chars();
  11.         for _ in 0.."Step ".len() {
  12.             c_i.next();
  13.         }
  14.  
  15.         let step_c = c_i.next().unwrap();
  16.         for _ in 0.." must be finished before step ".len() {
  17.             c_i.next();
  18.         }
  19.         let next_step = c_i.next().unwrap();
  20.         let e = output.entry(next_step).or_insert(BTreeSet::new());
  21.         e.insert(step_c);
  22.     }
  23.  
  24.     output
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top