diff --git a/challenge-2/submissions/elecycele/solution-template.go b/challenge-2/submissions/elecycele/solution-template.go new file mode 100644 index 000000000..201fe6d14 --- /dev/null +++ b/challenge-2/submissions/elecycele/solution-template.go @@ -0,0 +1,38 @@ +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 { + // TODO: Implement the function + runes := []rune(s) + i := 0 + j := len(s) -1 + + + for i < j { + runes[i], runes[j] = runes[j], runes[i] + + i++ + j-- + } + return string(runes) +}