Cody

# Problem 519. Pig Latin to English Translator

Solution 1871928

Submitted on 11 Jul 2019 by Michael Cappello
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
str1 = 'estion-quay'; str2 = 'question'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×2 cell array {'estion'} {'quay'} s1 = 1×2 cell array {'estion'} {'qu'} s1 = 'question'

2   Pass
str1 = 'another-ay'; str2 = 'another'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×2 cell array {'another'} {'ay'} s1 = 1×2 cell array {'another'} {0×0 char} s1 = 'another'

3   Pass
str1 = 'ix-nay'; str2 = 'nix'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×2 cell array {'ix'} {'nay'} s1 = 1×2 cell array {'ix'} {'n'} s1 = 'nix'

4   Pass
str1 = 'another-ay one-ay ites-bay e-thay ust-day'; str2 = 'another one bites the dust'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×10 cell array {'another'} {'ay'} {'one'} {'ay'} {'ites'} {'bay'} {'e'} {'thay'} {'ust'} {'day'} s1 = 1×10 cell array {'another'} {0×0 char} {'one'} {0×0 char} {'ites'} {'b'} {'e'} {'th'} {'ust'} {'d'} s1 = 'another one bites the dust'

5   Pass
str1 = 'ow-hay uch-may ood-way ould-way a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way'; str2 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×26 cell array Columns 1 through 16 {'ow'} {'hay'} {'uch'} {'may'} {'ood'} {'way'} {'ould'} {'way'} {'a'} {'ay'} {'oodchuck'} {'way'} {'uck'} {'chay'} {'if'} {'ay'} Columns 17 through 26 {'a'} {'ay'} {'oodchuck'} {'way'} {'ould'} {'cay'} {'uck'} {'chay'} {'ood'} {'way'} s1 = 1×26 cell array Columns 1 through 17 {'ow'} {'h'} {'uch'} {'m'} {'ood'} {'w'} {'ould'} {'w'} {'a'} {0×0 char} {'oodchuck'} {'w'} {'uck'} {'ch'} {'if'} {0×0 char} {'a'} Columns 18 through 26 {0×0 char} {'oodchuck'} {'w'} {'ould'} {'c'} {'uck'} {'ch'} {'ood'} {'w'} s1 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood'

6   Pass
str1 = 'eter-pay iper-pay icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay'; str2 = 'peter piper picked a peck of pickle peppers'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×16 cell array {'eter'} {'pay'} {'iper'} {'pay'} {'icked'} {'pay'} {'a'} {'ay'} {'eck'} {'pay'} {'of'} {'ay'} {'ickle'} {'pay'} {'eppers'} {'pay'} s1 = 1×16 cell array {'eter'} {'p'} {'iper'} {'p'} {'icked'} {'p'} {'a'} {0×0 char} {'eck'} {'p'} {'of'} {0×0 char} {'ickle'} {'p'} {'eppers'} {'p'} s1 = 'peter piper picked a peck of pickle peppers'

7   Pass
str1 = 'our-fay ore-scay'; str2 = 'four score'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

s1 = 1×4 cell array {'our'} {'fay'} {'ore'} {'scay'} s1 = 1×4 cell array {'our'} {'f'} {'ore'} {'sc'} s1 = 'four score'