Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 518. English to Pig Latin Translator

Created by @bmtran

Pig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):

1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and "ay" is added, as in the following examples:

  • happy → appy-hay
  • question → estion-quay

2. In words that begin with vowels, the syllable "ay" is simply added to the end of the word.

  • another → another-ay
  • about → about-ay

A hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means "spray" whereas ays-pray means "prays."

Given a string in english (may be multiple words), produce the Pig Latin version.

Problem Group

Solution Statistics

11 correct solutions 19 incorrect solutions
Last solution submitted on Nov 07, 2014

Solution Comments