|
1 | 1 | # Instructions
|
2 | 2 |
|
3 |
| -Implement a program that translates from English to Pig Latin. |
| 3 | +Your task is to translate text from English to Pig Latin using the following rules: |
4 | 4 |
|
5 |
| -Pig Latin is a made-up children's language that's intended to be |
6 |
| -confusing. It obeys a few simple rules (below), but when it's spoken |
7 |
| -quickly it's really difficult for non-children (and non-native speakers) |
8 |
| -to understand. |
9 |
| - |
10 |
| -- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word. Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay"). |
11 |
| -- **Rule 2**: If a word begins with a consonant sound, move it to the end of the word and then add an "ay" sound to the end of the word. Consonant sounds can be made up of multiple consonants, a.k.a. a consonant cluster (e.g. "chair" -> "airchay"). |
12 |
| -- **Rule 3**: If a word starts with a consonant sound followed by "qu", move it to the end of the word, and then add an "ay" sound to the end of the word (e.g. "square" -> "aresquay"). |
| 5 | +- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word (e.g. "apple" -> "appleay"). |
| 6 | + Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay"). |
| 7 | +- **Rule 2**: If a word begins with a consonant sound, move it to the end of the word and then add an "ay" sound to the end of the word (e.g. "pig" -> "igpay"). |
| 8 | + Consonant sounds can be made up of multiple consonants, such as the "ch" in "chair" or "st" in "stand" (e.g. "chair" -> "airchay"). |
| 9 | +- **Rule 3**: If a word starts with a consonant sound followed by "qu", move them to the end of the word, and then add an "ay" sound to the end of the word (e.g. "square" -> "aresquay"). |
13 | 10 | - **Rule 4**: If a word contains a "y" after a consonant cluster or as the second letter in a two letter word it makes a vowel sound (e.g. "rhythm" -> "ythmrhay", "my" -> "ymay").
|
14 |
| - |
15 |
| -There are a few more rules for edge cases, and there are regional |
16 |
| -variants too. |
17 |
| - |
18 |
| -See <http://en.wikipedia.org/wiki/Pig_latin> for more details. |
0 commit comments