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.
23 lines
692 B
23 lines
692 B
6 years ago
|
## searchreplace
|
||
6 years ago
|
|
||
6 years ago
|
### Instructions
|
||
6 years ago
|
|
||
6 years ago
|
Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument).
|
||
6 years ago
|
|
||
|
- If the number of arguments is not 3, just display a newline.
|
||
|
|
||
|
- If the second argument is not contained in the first one (the string) then the program simply rewrites the string followed by a newline.
|
||
|
|
||
6 years ago
|
### Expected output
|
||
6 years ago
|
|
||
|
```console
|
||
|
student@ubuntu:~/piscine/test$ go build
|
||
|
student@ubuntu:~/piscine/test$ ./test "hella there" "a" "o"
|
||
|
hello there
|
||
|
student@ubuntu:~/piscine/test$ ./test "abcd" "z" "l"
|
||
|
abcd
|
||
|
student@ubuntu:~/piscine/test$ ./test "something" "a" "o" "b" "c"
|
||
|
|
||
6 years ago
|
student@ubuntu:~/piscine/test$
|
||
|
```
|