#K10386. Sort Names by Vowel Priority
Sort Names by Vowel Priority
Sort Names by Vowel Priority
You are given a list of names. Your task is to rearrange the names so that all names that start with a vowel (\(a, e, i, o, u\)) appear before names that start with a consonant. The relative order of the names within the group of vowels and the group of consonants must remain the same as in the original list.
Example 1:
Input: 5 Alice Bob Eve Charlie Oscar</p>Output: Alice Eve Oscar Bob Charlie
Example 2:
Input: 5 Zachary Yvonne Uma Quincy Ian</p>Output: Uma Ian Zachary Yvonne Quincy
Note: The input is read from standard input (stdin) and the output is printed to standard output (stdout).
inputFormat
The first line contains an integer \(n\) indicating the number of names. The following \(n\) lines each contain one name.
Constraints:
- \(1 \leq n \leq 10^5\)
- Each name is a non-empty string consisting of only alphabetic characters.
outputFormat
Output the rearranged list of names in one line, separated by a single space. Names starting with a vowel appear first (maintaining original order), followed by names starting with a consonant (also in the original order).
## sample5
Alice
Eve
Oscar
Isabel
Uma
Alice Eve Oscar Isabel Uma