/interview-test-sapho-citrix

Sapho/Citrix Employment Test

Primary LanguageJava

Pig Latin Task

Write some Java code that translates a string (word, sentence, or paragraph) into “pig-latin” using the following rules.

  1. Words that start with a consonant have their first letter moved to the end of the word and the letters “ay” added to the end. Hello becomes Ellohay
  2. Words that start with a vowel have the letters “way” added to the end. apple becomes appleway
  3. Words that end in “way” are not modified. stairway stays as stairway
  4. Punctuation must remain in the same relative place from the end of the word. can’t becomes antca’y end. becomes endway.
  5. Hyphens are treated as two words this-thing becomes histay-hingtay
  6. Capitalization must remain in the same place. Beach becomes Eachbay McCloud becomes CcLoudmay