From d7c44583e0469b7f76df9a29bd18a658be42977a Mon Sep 17 00:00:00 2001 From: "go-interview-practice-bot[bot]" <230190823+go-interview-practice-bot[bot]@users.noreply.github.com> Date: Sat, 6 Dec 2025 23:13:52 +0000 Subject: [PATCH] Add solution for Challenge 2 --- .../submissions/cckwes/solution-template.go | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 challenge-2/submissions/cckwes/solution-template.go diff --git a/challenge-2/submissions/cckwes/solution-template.go b/challenge-2/submissions/cckwes/solution-template.go new file mode 100644 index 00000000..1fc752b4 --- /dev/null +++ b/challenge-2/submissions/cckwes/solution-template.go @@ -0,0 +1,34 @@ +package main + +import ( + "bufio" + "fmt" + "os" +) + +func main() { + // Read input from standard input + scanner := bufio.NewScanner(os.Stdin) + if scanner.Scan() { + input := scanner.Text() + + // Call the ReverseString function + output := ReverseString(input) + + // Print the result + fmt.Println(output) + } +} + +// ReverseString returns the reversed string of s. +func ReverseString(s string) string { + runes := []rune(s) + stringLength := len(runes) + result := make([]rune, stringLength) + + for i := 0; i < stringLength; i++ { + result[stringLength - 1 - i] = runes[i] + } + + return string(result) +}