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.

29 lines
983 B

## lastword
### Instructions
5 years ago
Écrire un programme qui prend une `string` et qui affiche son dernier mot, suivi d'un retour à la ligne (`'\n'`).
5 years ago
- Un mot est une section de `string` délimitée par des espaces ou par le début/fin d'une `string`.
5 years ago
- L'output sera suivi d'un retour à la ligne (`'\n'`).
5 years ago
- Si le nombre de paramètres est différent de 1, ou si il n'y a pas de mot, le programme affiche un retour à la ligne (`'\n'`).
### Utilisation
```console
5 years ago
student@ubuntu:~/piscine-go/lastword$ go build
student@ubuntu:~/piscine-go/lastword$ ./lastword "FOR PONY" | cat -e
PONY$
5 years ago
student@ubuntu:~/piscine-go/lastword$ ./lastword "this ... is sparta, then again, maybe not" | cat -e
not$
5 years ago
student@ubuntu:~/piscine-go/lastword$ ./lastword " " | cat -e
$
5 years ago
student@ubuntu:~/piscine-go/lastword$ ./lastword "a" "b" | cat -e
$
5 years ago
student@ubuntu:~/piscine-go/lastword$ ./lastword " lorem,ipsum " | cat -e
lorem,ipsum$
5 years ago
student@ubuntu:~/piscine-go/lastword$
```