about | help | code help+videos | done | prefs |
In this exercise we will make the rules for Pig Latin more complete. Like in the first version of piglatin, An English word is translated into Pig Latin by the following rules: if the word starts with one or more consonants then they are moved to the end, and "ay" is added to the end after that. If the word starts with a vowel, then just add 'way' to the end. In addition, there are three new rules: (1) in the initial sequence of consonants, a 'qu' counts as consonants. (2) If the original word is all uppercase, the final result should be all uppercase, and if the original word was "title case" (meaning first letter uppercase and rest lowercase) then the result should be too: 'AAA' becomes 'AAAWAY' and 'Pig' becomes 'Igpay'. (3) 'Y' is considered a consonant at the start of a word but a vowel in the middle, so 'style' becomes 'ylestay' and 'yellow' becomes 'ellowyay'. piglatin2('MBA') → 'AMBAY' piglatin2('AM') → 'AMWAY' piglatin2('Pig') → 'Igpay' ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 211 Post-solution available
Copyright Nick Parlante 2017 - privacy