You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
## piglatin
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Write a **program** that transforms a string passed as argument in its `Pig Latin` version.
|
|
|
|
|
|
|
|
The rules used by Pig Latin are as follows:
|
|
|
|
|
|
|
|
- If a word begins with a vowel, just add "ay" to the end.
|
|
|
|
- If it begins with a consonant, then we take all consonants before the first vowel and we put them on the end of the word and add "ay" at the end.
|
|
|
|
|
|
|
|
If the word has no vowels the program should print "No vowels".
|
|
|
|
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
If the number of arguments is different from one, the program prints nothing.
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
```console
|
|
|
|
student@ubuntu:~/student/test$ go build
|
|
|
|
student@ubuntu:~/student/test$ ./piglatin
|
|
|
|
student@ubuntu:~/student/test$ ./piglatin pig | cat -e
|
|
|
|
igpay$
|
|
|
|
student@ubuntu:~/student/test$ ./piglatin Is | cat -e
|
|
|
|
Isay$
|
|
|
|
student@ubuntu:~/student/test$ ./piglatin crunch | cat -e
|
|
|
|
unchcray$
|
|
|
|
student@ubuntu:~/student/test$ ./piglatin crnch | cat -e
|
|
|
|
No vowels$
|
|
|
|
student@ubuntu:~/student/test$ ./piglatin something else | cat -e
|
|
|
|
$
|
|
|
|
```
|