Created
June 14, 2020 16:47
-
-
Save vivax3794/8826de9b8411bded3dfb825276c26937 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io; | |
macro_rules! parse_input { | |
($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap()) | |
} | |
/** | |
* Auto-generated code below aims at helping you parse | |
* the standard input according to the problem statement. | |
**/ | |
fn main() { | |
let mut input_line = String::new(); | |
io::stdin().read_line(&mut input_line).unwrap(); | |
let sentence = input_line.trim_end().to_string(); | |
let mut o: Vec<String> = Vec::new(); | |
let v = String::from("aeiouAEIOU"); | |
for x in sentence.split_whitespace() { | |
o.push( | |
x | |
.chars() | |
.map(|c| if v.contains(c) {1} else {0}) | |
.sum::<i128>() | |
.to_string() | |
) | |
} | |
println!("{}", o.join(" ")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment