Write a program which accepts a sentence into stdin, and writes that sentence to stdout in pig latin.
Here are some test cases which your program should handle:
Read your script
ead-Ray our-yay ipt-scray
Hyphenation is mandatory. Note that multiple consonants at the start of the word must all be moved to the end. Capitalization of the output does not matter;
ead-ray are also valid translations of
An utterance is allowed an opening vowel
An-way utterance-way is-way allowed-way an-way opening-way owel-vay
Words starting with vowels have
-way appended in their pig latin form (don't forget to handle capital opening vowels)
Words consisting entirely of consonants should have a hyphen prepended, and
Punctuation is undefined; I don't care if leading or trailing punctuation ends up inside the pig latin word.
This is code golf; the shortest program by character count wins. I've written a solution myself which handles all these cases which I shall post as a response.