TopcoderArchiveVisit Topcoder
SRM9 Dec 2006
SRM 329

VowelEncryptor

Problem statement, definition, constraints, and public examples.

Problem Statement

You are given a String[] text, each element of which contains a single word. Encrypt the text by removing all vowels ('a', 'e', 'i', 'o', 'u') from every word that contains at least one non-vowel. If a word consists only of vowels, leave it as is. Return the result as a String[], where the ith element is the encrypted version of the ith element in text.

Definition

Class:
VowelEncryptor
Method:
encrypt
Parameters:
String[]
Returns:
String[]
Method signature:
String[] encrypt(String[] text)
(be sure your method is public)

Constraints

  • text will contain between 1 and 50 elements, inclusive.
  • Each element of text will contain between 1 and 20 lowercase letters ('a'-'z'), inclusive.

Examples

  1. {"hello", "world"}
    Returns: {"hll", "wrld" }
  2. {"a", "b", "c"}
    Returns: {"a", "b", "c" }
  3. {"he", "who", "is", "greedy", "is", "disgraced"}
    Returns: {"h", "wh", "s", "grdy", "s", "dsgrcd" }
Back to all problems