Pig Latin to English Translator - MATLAB Cody - MATLAB Central

Problem 519. Pig Latin to English Translator

Difficulty:Rate

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 Pig Latin (may be multiple words), produce the English version.

Solution Stats

45.99% Correct | 54.01% Incorrect
Last Solution submitted on Apr 03, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers157

Suggested Problems

More from this Author56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!