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.
25 lines
941 B
25 lines
941 B
6 years ago
|
## expandstr
|
||
|
|
||
|
### Instructions
|
||
|
|
||
5 years ago
|
Write a program that takes a `string` and displays it with exactly three spaces between each word, with no spaces or tabs at either the beginning nor the end.
|
||
6 years ago
|
|
||
5 years ago
|
The `string` will be followed by a newline (`'\n'`).
|
||
6 years ago
|
|
||
6 years ago
|
A word is a sequence of alphanumerical characters.
|
||
|
|
||
5 years ago
|
If the number of arguments is not 1, or if there are no word, the program displays nothing.
|
||
6 years ago
|
|
||
5 years ago
|
### Usage
|
||
6 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/expandstr$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/expandstr$ ./expandstr "you see it's easy to display the same thing" | cat -e
|
||
6 years ago
|
you see it's easy to display the same thing$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/expandstr$ ./expandstr " only it's harder " | cat -e
|
||
6 years ago
|
only it's harder$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/expandstr$ ./expandstr " how funny it is" "did you hear, Mathilde ?" | cat -e
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/expandstr$ ./expandstr
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/expandstr$
|
||
6 years ago
|
```
|