Cody

# Problem 519. Pig Latin to English Translator

Solution 1222798

Submitted on 30 Jun 2017
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))

d = 7 c = 8 par = 'estion' e = ' question' p = 'y' e = 'question'

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

d = 8 par = 'another' e = ' another'

Matrix index is out of range for deletion. Error in piglatin2english (line 21) p(1:d+3)=[]; Error in TestPoint2 (line 3) str1_f = piglatin2english(str1);

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

d = 3 c = 4 par = 'ix' e = ' nix' p = 1×0 empty char array e = 'nix'

4   Fail
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))

d = 8 par = 'another' e = ' another' d = 4 par = 'one' e = ' another one' d = 5 c = 6 par = 'ites' e = ' another one bites' p = ' e-thay ust-day' d = 3 c = 4 par = 'e' e = ' another one bites the' p = 'y ust-day' d = 6 c = 7 par = 'yust' e = ' another one bites the dyust' p = 1×0 empty char array e = 'another one bites the dyust'

Assertion failed.

5   Fail
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))

d = 3 c = 4 par = 'ow' e = ' how' p = ' uch-may ood-way ould-way a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 5 c = 6 par = 'uch' e = ' how much' p = ' ood-way ould-way a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 5 c = 6 par = 'ood' e = ' how much wood' p = ' ould-way a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 6 c = 7 par = 'ould' e = ' how much wood would' p = ' a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 3 par = 'a' e = ' how much wood would a' d = 9 c = 10 par = 'oodchuck' e = ' how much wood would a woodchuck' p = ' uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 5 c = 6 par = 'uck' e = ' how much wood would a woodchuck chuck' p = 'y if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 5 par = 'yif' e = ' how much wood would a woodchuck chuck yif' d = 2 par = 'a' e = ' how much wood would a woodchuck chuck yif a' d = 9 c = 10 par = 'oodchuck' e = ' how much wood would a woodchuck chuck yif a woodchuck' p = ' ould-cay uck-chay ood-way' d = 6 c = 7 par = 'ould' e = ' how much wood would a woodchuck chuck yif a woodchuck could' p = ' uck-chay ood-way' d = 5 c = 6 par = 'uck' e = ' how much wood would a woodchuck chuck yif a woodchuck could chuck' p = 'y ood-way' d = 6 c = 7 par = 'yood' e = ' how much wood would a woodchuck chuck yif a woodchuck could chuck wyood' p = 1×0 empty char array e = 'how much wood would a woodchuck chuck yif a woodchuck could chuck wyood'

Assertion failed.

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))

d = 5 c = 6 par = 'eter' e = ' peter' p = ' iper-pay icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay' d = 6 c = 7 par = 'iper' e = ' peter piper' p = ' icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay' d = 7 c = 8 par = 'icked' e = ' peter piper picked' p = ' a-ay eck-pay of-ay ickle-pay eppers-pay' d = 3 par = 'a' e = ' peter piper picked a' d = 4 c = 5 par = 'eck' e = ' peter piper picked a peck' p = ' of-ay ickle-pay eppers-pay' d = 4 par = 'of' e = ' peter piper picked a peck of' d = 6 c = 7 par = 'ickle' e = ' peter piper picked a peck of pickle' p = ' eppers-pay' d = 8 c = 9 par = 'eppers' e = ' peter piper picked a peck of pickle peppers' p = 1×0 empty char array e = '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))

d = 4 c = 5 par = 'our' e = ' four' p = ' ore-scay' d = 5 c = 6 par = 'ore' e = ' four score' p = 'y' e = 'four score'