1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
pub fn detect(input: String){ let mut c = 0; let mut d = 0; for i in input.chars(){ if(i == 'a' || i == 'e' || i == 'i' || i == 'o' || i == 'u'){ c = c + 1; println!("{} is a vowel.",i); } else{ d = d + 1; println!("{} is not a vowel." , i ); } } println!("Total vowels: {}",c ); println!("Total consonants : {}",d); }