TopcoderARCHIVE
Archive/Problems/VowelCount
SRM · Problem 18005

VowelCount

Problem statement, definition, constraints, and public examples.

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
← All problems