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
{"hello", "world"}Returns: {"hll", "wrld" }{"a", "b", "c"}Returns: {"a", "b", "c" }{"he", "who", "is", "greedy", "is", "disgraced"}Returns: {"h", "wh", "s", "grdy", "s", "dsgrcd" }