Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement