diff --git a/challenge-2/submissions/macborowy/solution-template.go b/challenge-2/submissions/macborowy/solution-template.go new file mode 100644 index 00000000..813d30fd --- /dev/null +++ b/challenge-2/submissions/macborowy/solution-template.go @@ -0,0 +1,30 @@ +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 { + r := []rune(s) + for i, j := 0, len(r) - 1; i < j; i, j = i+1, j-1 { + r[i], r[j] = r[j], r[i] + } + return string(r) +}