package main import ( "os" "fmt" "bufio" ) func StringReverse(s string) string { n := len(s) runes := make([]rune, n) for _, rune := range s { n-- runes[n] = rune } return string(runes[n:]) } func main(){ source,_ := os.Open("source.txt") output,_ := os.Create("result.txt") defer source.Close() defer output.Close() scanner :=bufio.NewScanner(source) var s1 string var s2 string scanner.Scan() s1 = scanner.Text() s2 = StringReverse(s1) fmt.Fprintln(output,s2) }