3813. Vowel-Consonant Score Easy

@problem@discussion
#String#Simulation



1/**
2 * [3813] Vowel-Consonant Score
3 *
4 * You are given a string s consisting of lowercase English letters, spaces, and digits.
5 * Let v be the number of vowels in s and c be the number of consonants in s.
6 * A vowel is one of the letters 'a', 'e', 'i', 'o', or 'u', while any other letter in the English alphabet is considered a consonant.
7 * The score of the string s is defined as follows:
8 * 
9 * 	If c > 0, the score = floor(v / c) where floor denotes rounding down to the nearest integer.
10 * 	Otherwise, the score = 0.
11 * 
12 * Return an integer denoting the score of the string.
13 *  
14 * <strong class="example">Example 1:
15 * <div class="example-block">
16 * Input: <span class="example-io">s = "cooear"</span>
17 * Output: <span class="example-io">2</span>
18 * Explanation:
19 * The string s = "cooear" contains v = 4 vowels ('o', 'o', 'e', 'a') and c = 2 consonants ('c', 'r').
20 * The score is floor(v / c) = floor(4 / 2) = 2.
21 * </div>
22 * <strong class="example">Example 2:
23 * <div class="example-block">
24 * Input: <span class="example-io">s = "axeyizou"</span>
25 * Output: <span class="example-io">1</span>
26 * Explanation:
27 * The string s = "axeyizou" contains v = 5 vowels ('a', 'e', 'i', 'o', 'u') and c = 3 consonants ('x', 'y', 'z').
28 * The score is floor(v / c) = floor(5 / 3) = 1.
29 * </div>
30 * <strong class="example">Example 3:
31 * <div class="example-block">
32 * Input: <span class="example-io">s = "au 123"</span>
33 * Output: <span class="example-io">0</span>
34 * Explanation:
35 * The string s = "au 123" contains no consonants (c = 0), so the score is 0.
36 * </div>
37 *  
38 * Constraints:
39 * 
40 * 	1 <= s.length <= 100
41 * 	s consists of lowercase English letters, spaces and digits.
42 * 
43 */
44pub struct Solution {}
45
46// problem: https://leetcode.com/problems/vowel-consonant-score/
47// discuss: https://leetcode.com/problems/vowel-consonant-score/discuss/?currentPage=1&orderBy=most_votes&query=
48
49// submission codes start here
50
51impl Solution {
52    pub fn vowel_consonant_score(s: String) -> i32 {
53        0
54    }
55}
56
57// submission codes end
58
59#[cfg(test)]
60mod tests {
61    use super::*;
62
63    #[test]
64    fn test_3813() {
65    }
66}
67

Back
© 2026 bowen.ge All Rights Reserved.