Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unused_imports)]
- use std::borrow::*;
- use std::cmp::*;
- use std::collections::*;
- use std::iter::*;
- use std::mem::*;
- use std::*;
- fn main() {
- use std::io::*;
- macro_rules! print{($($a:tt)*)=>{($($a)*)}}
- let mut v = vec!["".into()];
- let mut z:Vec<String> = vec![];
- let mut s = vec!["".into()];
- let mut g = |a:String| {
- v.push(a);
- if v.len() == 5 {
- s = v.clone();
- s.sort();
- for i in &v {
- for j in s.windows(2) {
- if &j[1] == i {
- z.push(j[0].clone());
- }
- }
- }
- write!(stdout(),"{:?}",z);
- }
- ""
- };
- let arg0 = [
- "Beggars can't be choosers",
- "Do unto others as you would have them do to you",
- "Foop",
- "Egads",
- ];
- print!("[");
- for i in 0..arg0.len() {
- if i > 0 {
- print!(",");
- }
- print!("{:?}", g(arg0[i].to_string()));
- }
- print!("]");
- }
Add Comment
Please, Sign In to add comment