diff --git a/challenge-1/submissions/brenoamin/solution-template.go b/challenge-1/submissions/brenoamin/solution-template.go new file mode 100644 index 000000000..479c17741 --- /dev/null +++ b/challenge-1/submissions/brenoamin/solution-template.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" +) + +func main() { + var a, b int + // Read two integers from standard input + _, err := fmt.Scanf("%d, %d", &a, &b) + if err != nil { + fmt.Println("Error reading input:", err) + return + } + + // Call the Sum function and print the result + result := Sum(a, b) + fmt.Println(result) +} + +// Sum returns the sum of a and b. +func Sum(a int, b int) int { + return a + b +} diff --git a/challenge-2/submissions/brenoamin/solution-template.go b/challenge-2/submissions/brenoamin/solution-template.go new file mode 100644 index 000000000..e1a1f8584 --- /dev/null +++ b/challenge-2/submissions/brenoamin/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 { + runes := []rune(s) + for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { + runes[i], runes[j] = runes[j], runes[i] + } + return string(runes) +}