Cody

# Problem 518. English to Pig Latin Translator

Solution 2149393

Submitted on 3 Mar 2020 by Bernd Seggewiß
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 = 'question'; str2 = 'estion-quay'; str1_f = english2piglatin(str1); assert(strcmp(str1_f,str2))

actWord = 'question' placesOfCons = 1×8 logical array 1 1 0 1 1 0 0 1 placesOfVow = 1×8 logical array 0 1 1 0 0 1 1 0 mark = 2 5

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

actWord = 'another' placesOfCons = 1×7 logical array 0 1 0 1 1 0 1 placesOfVow = 1×7 logical array 1 0 1 0 0 1 0

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

actWord = 'nix' placesOfCons = 1×3 logical array 1 0 1 placesOfVow = 1×3 logical array 0 1 0 mark = 1

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

actWord = 'another' placesOfCons = 1×7 logical array 0 1 0 1 1 0 1 placesOfVow = 1×7 logical array 1 0 1 0 0 1 0 actWord = 'one' placesOfCons = 1×3 logical array 0 1 0 placesOfVow = 1×3 logical array 1 0 1 actWord = 'bites' placesOfCons = 1×5 logical array 1 0 1 0 1 placesOfVow = 1×5 logical array 0 1 0 1 0 mark = 1 3 actWord = 'the' placesOfCons = 1×3 logical array 1 1 0 placesOfVow = 1×3 logical array 0 0 1 mark = 2 actWord = 'dust' placesOfCons = 1×4 logical array 1 1 1 1 placesOfVow = 1×4 logical array 0 1 0 0

5   Pass
str1 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood'; str2 = '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'; str1_f = english2piglatin(str1); assert(strcmp(str1_f,str2))

actWord = 'how' placesOfCons = 1×3 logical array 1 0 1 placesOfVow = 1×3 logical array 0 1 0 mark = 1 actWord = 'much' placesOfCons = 1×4 logical array 1 1 1 1 placesOfVow = 1×4 logical array 0 1 0 0 actWord = 'wood' placesOfCons = 1×4 logical array 1 0 0 1 placesOfVow = 1×4 logical array 0 1 1 0 mark = 1 actWord = 'would' placesOfCons = 1×5 logical array 1 0 1 1 1 placesOfVow = 1×5 logical array 0 1 1 0 0 mark = 1 actWord = 'a' placesOfCons = logical 0 placesOfVow = logical 1 actWord = 'woodchuck' placesOfCons = 1×9 logical array 1 0 0 1 1 1 1 1 1 placesOfVow = 1×9 logical array 0 1 1 0 0 0 1 0 0 mark = 1 actWord = 'chuck' placesOfCons = 1×5 logical array 1 1 1 1 1 placesOfVow = 1×5 logical array 0 0 1 0 0 actWord = 'if' placesOfCons = 1×2 logical array 0 1 placesOfVow = 1×2 logical array 1 0 actWord = 'a' placesOfCons = logical 0 placesOfVow = logical 1 actWord = 'woodchuck' placesOfCons = 1×9 logical array 1 0 0 1 1 1 1 1 1 placesOfVow = 1×9 logical array 0 1 1 0 0 0 1 0 0 mark = 1 actWord = 'could' placesOfCons = 1×5 logical array 1 0 1 1 1 placesOfVow = 1×5 logical array 0 1 1 0 0 mark = 1 actWord = 'chuck' placesOfCons = 1×5 logical array 1 1 1 1 1 placesOfVow = 1×5 logical array 0 0 1 0 0 actWord = 'wood' placesOfCons = 1×4 logical array 1 0 0 1 placesOfVow = 1×4 logical array 0 1 1 0 mark = 1

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

actWord = 'peter' placesOfCons = 1×5 logical array 1 0 1 0 1 placesOfVow = 1×5 logical array 0 1 0 1 0 mark = 1 3 actWord = 'piper' placesOfCons = 1×5 logical array 1 0 1 0 1 placesOfVow = 1×5 logical array 0 1 0 1 0 mark = 1 3 actWord = 'picked' placesOfCons = 1×6 logical array 1 0 1 1 0 1 placesOfVow = 1×6 logical array 0 1 0 0 1 0 mark = 1 4 actWord = 'a' placesOfCons = logical 0 placesOfVow = logical 1 actWord = 'peck' placesOfCons = 1×4 logical array 1 0 1 1 placesOfVow = 1×4 logical array 0 1 0 0 mark = 1 actWord = 'of' placesOfCons = 1×2 logical array 0 1 placesOfVow = 1×2 logical array 1 0 actWord = 'pickle' placesOfCons = 1×6 logical array 1 0 1 1 1 0 placesOfVow = 1×6 logical array 0 1 0 0 0 1 mark = 1 5 actWord = 'peppers' placesOfCons = 1×7 logical array 1 0 1 1 0 1 1 placesOfVow = 1×7 logical array 0 1 0 0 1 0 0 mark = 1 4

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

actWord = 'four' placesOfCons = 1×4 logical array 1 0 1 1 placesOfVow = 1×4 logical array 0 1 1 0 mark = 1 actWord = 'score' placesOfCons = 1×5 logical array 1 1 0 1 0 placesOfVow = 1×5 logical array 0 0 1 0 1 mark = 2 4

### Community Treasure Hunt

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

Start Hunting!