Statistics

Problem Statement for "VowelCount"

Problem Statement

Words are composed of two types of letters, vowels and consonants. For purposes of our problem, 'a', 'e', 'i', 'o', and 'u' are vowels, and all other letters are consonants.

Given a String word, return the number of vowels it contains.

Definition

Class:
VowelCount
Method:
getCount
Parameters:
String
Returns:
int
Method signature:
int getCount(String word)
(be sure your method is public)

Constraints

  • word will contain between 1 and 10 characters, inclusive.
  • Each character of word will be a lower-case letter ('a'-'z').

Examples

  1. "kayak"

    Returns: 2

    There are two 'a' letters.

  2. "rhythm"

    Returns: 0

    There are no vowels at all.

  3. "strength"

    Returns: 1

    Just one vowel here.

  4. "abcdefghij"

    Returns: 3

  5. "aaaaaaaa"

    Returns: 8


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: