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