소 감



코 드

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)





}



Retrieved from http://wiki.zeropage.org/wiki.php/이태균/LittleAOI/문자반대출력
last modified 2021-02-07 05:30:34