We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e8ea4e commit bac0c51Copy full SHA for bac0c51
challenge-2/submissions/cckwes/solution-template.go
@@ -0,0 +1,34 @@
1
+package main
2
+
3
+import (
4
+ "bufio"
5
+ "fmt"
6
+ "os"
7
+)
8
9
+func main() {
10
+ // Read input from standard input
11
+ scanner := bufio.NewScanner(os.Stdin)
12
+ if scanner.Scan() {
13
+ input := scanner.Text()
14
15
+ // Call the ReverseString function
16
+ output := ReverseString(input)
17
18
+ // Print the result
19
+ fmt.Println(output)
20
+ }
21
+}
22
23
+// ReverseString returns the reversed string of s.
24
+func ReverseString(s string) string {
25
+ runes := []rune(s)
26
+ stringLength := len(runes)
27
+ result := make([]rune, stringLength)
28
29
+ for i := 0; i < stringLength; i++ {
30
+ result[stringLength - 1 - i] = runes[i]
31
32
33
+ return string(result)
34
0 commit comments