Challenge:
Take a sentence of input of any length and convert all the words in that sentence to pig latin. If you do not know what pig latin is please read Wikipedia: Pig Latin.
Specifications:
Assume all words are separated by spaces and all sentences either end with a exclamation, question mark or period.
Do not use the variant for vowels mentioned in Wikipedia.
For words such as bread and quiz it is perfectly acceptable for them to be readbay, uizqay instead of and eadbray and izquay.
Functions or methods are perfectly acceptable. In other words you do not need to take in user input, but you must display user output.
Assume no input contains a compound word.
Example:
Input: I am a happy man.
Output: Iway amway away appyhay anmay.
How to win:
The winner is the person who can write a program that will do the challenge with the least amount of characters.
He said "Hey, man!" aloud.
becomeEhay aidsay "Eyhay, anmay!" aloudway.
? I notice that most solutions do not, and many don't preserve the final punctuation. – Ghirlandaiocin >>
andcout <<
. Some solutions e.g. the C#'s one is just a pure function, that can cut down a lot of characters. – Prejudgequiz
->uizqay
is acceptable, and whetherbread
->readbay
is acceptable. (Writing a spec is hard :) ). – Prejudgecin >>
. No need to take user input. Hmmm... And as for those words you have brought up: do not worry about managing for words of those kind, they are acceptable as you have presented them, and as for compound words do not worry about them either. – Orbicularhonest
? Is the Wikipedia rule about silent consonants required? Shouldhonest
behonestway
oronesthay
? – Miser