There was an error while loading. Please reload this page.
1 parent 270f734 commit 7f38c45Copy full SHA for 7f38c45
challenge-2/submissions/kiramux/solution-template.go
@@ -0,0 +1,37 @@
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
+if len(s) == 0 {
26
+return ""
27
28
+str := []byte(s)
29
+left := 0
30
+right := len(str) - 1
31
+for left < right {
32
+str[left], str[right] = str[right], str[left]
33
+left++
34
+right--
35
36
+return string(str)
37
0 commit comments