You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
309 B
11 lines
309 B
3 years ago
|
fn main() {
|
||
|
let phrase = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
|
||
|
let mapper = [
|
||
|
Box::new(|x: char| x.to_uppercase()),
|
||
|
Box::new(|x: char| x.to_lowercase()),
|
||
|
]
|
||
|
.iter()
|
||
|
.cycle();
|
||
|
println!("{}", phrase.chars().map(mapper.next()).collect().join(""));
|
||
|
}
|