Created
December 29, 2016 07:52
-
-
Save cipepser/09251fc66515bb60f15d58721c08466a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func Reverse(s string) string { | |
t := make([]rune, len(s)) | |
for i, c := range s { | |
t[len(s) - i- 1] = c | |
} | |
return string(t) | |
} | |
func main() { | |
var s string = "stressed" | |
fmt.Println(Reverse(s)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment