This question already has an answer here:
- Program to Spoonerise words [duplicate] 7 answers
Here is another short string related code-golf. You must write a full program that reads a string (from STDIN or as command line arguments, as long as you specify which) and wips the flords around (flips the words around). A valid flord wip must
Flip all of the beginning consonants. (All of the leading consonants up to the first vowel) For example, "Flipping Words" does not become "Wlipping Fords" because this only flips the first letter of each. Instead, it becomes "Wipping Flords"
Never flip a vowel. For example, "Eating Breakfast" becomes "Breating Eakfast"
Capitalize the first letter of each output word, and no more. For example 'Stack Overflow' becomes 'Ack Stoverflow', not 'ack StOverflow'.
Will have the first letter of every word capitalized, and all the other letters lowercase.
Will consist entirely of upper and lowercase letters and spaces. There will not be any extra or leading spaces.
There will be no strange consonant only words. For the purposes of this challenge, "y" is a consonant.
Will have at least 2 words, each separated with a single space. If there are an even number of words, you must flip the first word with the second, the third with the fourth, the fifth with the sixth and so on and so forth. If there are an odd number of words, the same rules apply, and the last word is skipped.
Here are some sample inputs and outputs.
Bunny Rabbit ---> Runny Babbit
Programming Puzzles And Code Golf ---> Pogramming Pruzzles Cand Ode Golf
The Cake Is A Lie ---> Ce Thake Is A Lie ("Is" and "A" both start with a vowel, so nothing changes. "Lie" is the last odd-word-out so nothing changes)
May The Best Golfer Win ---> Thay Me Gest Bolfer Win