Guest User

Untitled

a guest
Jun 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #![allow(unused_imports)]
  2. use std::borrow::*;
  3. use std::cmp::*;
  4. use std::collections::*;
  5. use std::iter::*;
  6. use std::mem::*;
  7. use std::*;
  8. fn main() {
  9. use std::io::*;
  10. macro_rules! print{($($a:tt)*)=>{($($a)*)}}
  11. let mut v = vec!["".into()];
  12. let mut z:Vec<String> = vec![];
  13. let mut s = vec!["".into()];
  14. let mut g = |a:String| {
  15. v.push(a);
  16. if v.len() == 5 {
  17. s = v.clone();
  18. s.sort();
  19. for i in &v {
  20. for j in s.windows(2) {
  21. if &j[1] == i {
  22. z.push(j[0].clone());
  23. }
  24. }
  25. }
  26. write!(stdout(),"{:?}",z);
  27. }
  28. ""
  29. };
  30.  
  31. let arg0 = [
  32. "Beggars can't be choosers",
  33. "Do unto others as you would have them do to you",
  34. "Foop",
  35. "Egads",
  36.  
  37. ];
  38.  
  39. print!("[");
  40. for i in 0..arg0.len() {
  41. if i > 0 {
  42. print!(",");
  43. }
  44. print!("{:?}", g(arg0[i].to_string()));
  45. }
  46. print!("]");
  47. }
Add Comment
Please, Sign In to add comment