forked from root/public
Compare commits
9 Commits
master
...
DEV-3179-n
Author | SHA1 | Date |
---|---|---|
jrosendo | 2b4cbb243d | 2 years ago |
Tiago Collot | f247c82851 | 2 years ago |
zainab Dnaya | 634d30e7f2 | 2 years ago |
zainab Dnaya | f0c4f46cfb | 2 years ago |
zainab Dnaya | f5236f8554 | 2 years ago |
zainab Dnaya | 3d5d905a0a | 2 years ago |
zainab Dnaya | fcf4e448c9 | 2 years ago |
zainab Dnaya | 8e02b56142 | 2 years ago |
zainabdnaya | c372e8a77e | 2 years ago |
1 changed files with 47 additions and 0 deletions
@ -0,0 +1,47 @@
|
||||
## thirdtimeisacharm |
||||
|
||||
### Instructions |
||||
|
||||
Write a function `ThirdTimeIsACharm()` that takes a `string` as an argument and returns another `string` with every third character. |
||||
|
||||
- Return the output followed by a newline `\n`. |
||||
- If the `string` is empty, return a newline `\n`. |
||||
- If there is no third character, return a newline `\n`. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func ThirdTimeIsACharm(str string) string { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"piscine" |
||||
) |
||||
|
||||
func main() { |
||||
fmt.Print(piscine.ThirdTimeIsACharm("123456789")) |
||||
fmt.Print(piscine.ThirdTimeIsACharm("")) |
||||
fmt.Print(piscine.ThirdTimeIsACharm("a b c d e f")) |
||||
fmt.Print(piscine.ThirdTimeIsACharm("12")) |
||||
} |
||||
``` |
||||
|
||||
And its output: |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
369$ |
||||
$ |
||||
b e$ |
||||
$ |
||||
``` |
Loading…
Reference in new issue