fn main() { println!(); let mut str = ('a'..='z').collect::(); let bad = ('n'..='z').collect::(); let rng: Vec<_> = ('n'..='z').collect(); let err: &[_] = &&rng; let sls = ""; let st2 = "kkkwwwaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz"; println!("{:?}\t{:?}\t{:?}\t{:?}", func(&str), &str.trim_matches(err), str.len(), sls ); println!("\n{:?}\n{:?}\t{:?}:{:?}", st2, st2.chars().filter(|&c| err.contains(&c)).collect::(), st2.chars().filter(|&c| "nopqrstuvwxyz".contains(c)).count(), st2.len() ); println!("\n{:?}\n{:?}\t{:?}:{:?}", st2, st2.chars().filter(|&c| c > 'm').collect::(), st2.chars().filter(|&c| c > 'm').count(), st2.len() ); println!("\n{:?}\t{:?}", str, str.chars().filter(|&c| err.contains(&c)).collect::(), ); println!(); } fn func(s: &str) -> String { s.into() } fn printer_error(s: &str) -> String { format!("{}/{}", s.chars().filter(|&c| "nopqrstuvwxyz".contains(c)).count(), s.len() ) } #[cfg(test)] mod tests { use super::*; #[test] fn should_pass_all_the_tests_provided() { assert_eq!(&printer_error("aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz"), "3/56"); assert_eq!(&printer_error("kkkwwwaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz"), "6/60"); assert_eq!(&printer_error("kkkwwwaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyzuuuuu"), "11/65"); } }