mirror of https://github.com/01-edu/public.git
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.
30 lines
961 B
30 lines
961 B
5 years ago
|
## cleanstr
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Write a **program** that takes a `string`, and displays this `string` with exactly:
|
||
5 years ago
|
|
||
5 years ago
|
- one space between words.
|
||
|
- without spaces nor tabs at the beginning nor at the end.
|
||
|
- with the result followed by a newline ("`\n`").
|
||
|
|
||
|
A "word" is defined as a part of a `string` delimited either by spaces/tabs, or
|
||
|
by the start/end of the `string`.
|
||
|
|
||
|
If the number of arguments is not 1, or if there are no words to display, the
|
||
![]()
4 years ago
|
program displays nothing.
|
||
5 years ago
|
|
||
|
### Usage :
|
||
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cleanstr$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/cleanstr$ ./cleanstr "you see it's easy to display the same thing" | cat -e
|
||
5 years ago
|
you see it's easy to display the same thing$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cleanstr$ ./cleanstr " only it's harder "
|
||
5 years ago
|
only it's harder$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cleanstr$ ./cleanstr " how funny" "Did you hear Mathilde ?"
|
||
5 years ago
|
$
|
||
![]()
4 years ago
|
student@ubuntu:~/[[ROOT]]/cleanstr$ ./cleanstr ""
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/cleanstr$
|
||
5 years ago
|
```
|