#K8741. Extract Vowels and Consonants
Extract Vowels and Consonants
Extract Vowels and Consonants
Given an input string s
that may contain letters, spaces, and punctuation, your task is to extract all the vowels and consonants from it. Only alphabetic characters are considered. The vowels are defined as $$V = \{a, e, i, o, u, A, E, I, O, U\}$$ and any alphabetic character not in \(V\) is a consonant.
Your program should output two lines. The first line contains the vowels extracted in the order they appear in the input, and the second line contains the consonants in their original order. If there are no vowels or no consonants, output an empty line accordingly.
Note: All non-alphabetical characters should be ignored.
inputFormat
The input consists of a single line from standard input which contains the string s
. The string may include letters, spaces, and punctuation.
outputFormat
Print two lines to standard output. The first line should consist of all vowels present in the input string in the order they appear. The second line should consist of all consonants in the order they appear. If no vowels (or consonants) are found, print an empty line for that case.
## sampleHello, World!
eoo
HllWrld
</p>