diff --git a/LibreOJ/3/3.go b/LibreOJ/3/3.go new file mode 100644 index 00000000..6c519416 --- /dev/null +++ b/LibreOJ/3/3.go @@ -0,0 +1,20 @@ +package main + +import ( + "bufio" + "os" +) + +func main() { + file, _ := os.Open("copycat.in") + out, _ := os.OpenFile("copycat.out", os.O_WRONLY|os.O_CREATE, 0644) + reader := bufio.NewReader(file) + writer := bufio.NewWriter(out) + + x, e := reader.ReadString('\n') + for e == nil { + x, e = reader.ReadString('\n') + writer.WriteString(x) + } + writer.Flush() +}