Cody

# Problem 519. Pig Latin to English Translator

Solution 1222794

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   Fail
str1 = 'estion-quay'; str2 = 'question'; str1_f = piglatin2english(str1); assert(strcmp(str1_f,str2))

d = 7 c = 'q' par = 'estion' e = ' qestion' p = 'y'

Assertion failed.

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 16) 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 = 'n' par = 'ix' e = ' nix' p = 1×0 empty char array

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' p = 'one-ay ites-bay e-thay ust-day' d = 4 par = 'one' e = ' another one' p = 'ites-bay e-thay ust-day' d = 5 c = 'b' par = 'ites' e = ' another one bites' p = ' e-thay ust-day' d = 3 c = 't' par = 'e' e = ' another one bites te' p = 'y ust-day' d = 6 c = 'd' par = 'yust' e = ' another one bites te dyust' p = 1×0 empty char array

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 = 'h' 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 = 'm' 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 = 'w' 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 = 'w' 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' p = 'oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way' d = 9 c = 'w' 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 = 'c' par = 'uck' e = ' how much wood would a woodchuck cuck' 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 cuck yif' p = 'a-ay oodchuck-way ould-cay uck-chay ood-way' d = 2 par = 'a' e = ' how much wood would a woodchuck cuck yif a' p = 'oodchuck-way ould-cay uck-chay ood-way' d = 9 c = 'w' par = 'oodchuck' e = ' how much wood would a woodchuck cuck yif a woodchuck' p = ' ould-cay uck-chay ood-way' d = 6 c = 'c' par = 'ould' e = ' how much wood would a woodchuck cuck yif a woodchuck could' p = ' uck-chay ood-way' d = 5 c = 'c' par = 'uck' e = ' how much wood would a woodchuck cuck yif a woodchuck could cuck' p = 'y ood-way' d = 6 c = 'w' par = 'yood' e = ' how much wood would a woodchuck cuck yif a woodchuck could cuck wyood' p = 1×0 empty char array

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

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

d = 4 c = 'f' par = 'our' e = ' four' p = ' ore-scay' d = 5 c = 's' par = 'ore' e = ' four sore' p = 'y'

Assertion failed.