#C12970. Reverse Vowels in a String
Reverse Vowels in a String
Reverse Vowels in a String
You are given a string s
. Your task is to reverse only the vowels in s
while keeping all other characters in their original positions.
The vowels are defined as \(a, e, i, o, u\) in both lowercase and uppercase. For example, in the string "hello world", the vowels are e, o, o
. After reversing the vowels, the string becomes "hollo werld".
Example:
Input: hello world Output: hollo werld
Use the standard input (stdin) to read the input string and output the answer via standard output (stdout).
inputFormat
The input consists of a single line containing the string s
which may include spaces, punctuation, and both lowercase and uppercase letters.
outputFormat
Output the transformed string after reversing only the vowels while keeping the positions of the other characters unchanged.
## samplehello world
hollo werld