U E D R , A S I H C RSS

이태균/LittleAOI/문자반대출력 (rev. 1.1)

이태균/LittleAOI/문자반대출력

소 감



코 드

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)





}



Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:34
Processing time 0.0198 sec