Reverse
Time limit1sMemory limit1024 MB
For each input line, reverse the order of the words that start with a vowel and leave consonant-initial words in their original positions.
- Level
Easy3 of 10
- Topics
- String, Two pointers, Implementation
- Solved
- No attempts yet
Problem
At a contest you have been asked to write a program that reads in a line of text and reverses the order of all words that begin with vowels. Words that begin with consonants keep their position in the line of text. You are not sure why you would ever need this, but it is worth points.
Input
There will be an unknown number of lines to process. Each line will contain only words, each separated by a single space.
Output
For each input, display the converted line on its own line.