|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
## reversesecondhalf |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
Write a function that takes a `string` as an argument and prints the second half reversed. If the length of the string is odd, round it up. |
|
|
|
|
Write a function that takes a `string` as an argument and prints the second half reversed. If the length of the `string` is odd, round it up. |
|
|
|
|
|
|
|
|
|
- Print the second half reversed followed by newline `\n`. |
|
|
|
|
- If the string is empty, return `Invalid Output`. |
|
|
|
|
- If the string's length equals one, return it, followed by newline `\n`. |
|
|
|
|
- Print the second half reversed followed by a newline `\n`. |
|
|
|
|
- If the `string` is empty, return `Invalid Output`. |
|
|
|
|
- If the `string` length equals one, return it, followed by a newline `\n`. |
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
|
|
|
|
|
@ -22,12 +22,15 @@ Here is a possible program to test your function:
|
|
|
|
|
```go |
|
|
|
|
package main |
|
|
|
|
|
|
|
|
|
import "fmt" |
|
|
|
|
import ( |
|
|
|
|
"fmt" |
|
|
|
|
"piscine" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
fmt.Print(ReverseSecondHalf("This is the 1st half This is the 2nd half")) |
|
|
|
|
fmt.Print(ReverseSecondHalf("")) |
|
|
|
|
fmt.Print(ReverseSecondHalf("Hello World")) |
|
|
|
|
fmt.Print(piscine.ReverseSecondHalf("This is the 1st half This is the 2nd half")) |
|
|
|
|
fmt.Print(piscine.ReverseSecondHalf("")) |
|
|
|
|
fmt.Print(piscine.ReverseSecondHalf("Hello World")) |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|