First commit of partial RosettaCode contents.
Pushing this for testing purposes. Lots of work still needed.
This commit is contained in:
commit
1e05ecd7ee
781 changed files with 9080 additions and 0 deletions
39
Task/Narcissist/Go/narcissist-2.go
Normal file
39
Task/Narcissist/Go/narcissist-2.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := fmt.Sprintf("%s%c%s%c\n", x, 0x60, x, 0x60)
|
||||
in, _ := ioutil.ReadAll(os.Stdin)
|
||||
if bytes.Equal(in, []byte(s)) {
|
||||
fmt.Println("Accept")
|
||||
} else {
|
||||
fmt.Println("Reject")
|
||||
}
|
||||
}
|
||||
|
||||
var x = `package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := fmt.Sprintf("%s%c%s%c\n", x, 0x60, x, 0x60)
|
||||
in, _ := ioutil.ReadAll(os.Stdin)
|
||||
if bytes.Equal(in, []byte(s)) {
|
||||
fmt.Println("Accept")
|
||||
} else {
|
||||
fmt.Println("Reject")
|
||||
}
|
||||
}
|
||||
|
||||
var x = `
|
||||
1
Task/Narcissist/Go/narcissist.go
Normal file
1
Task/Narcissist/Go/narcissist.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
package main; import "os"; import "fmt"; import "bytes"; import "io/ioutil"; func main() {ios := "os"; ifmt := "fmt"; ibytes := "bytes"; iioutil := "io/ioutil"; zero := "Reject"; one := "Accept"; x := "package main; import %q; import %q; import %q; import %q; func main() {ios := %q; ifmt := %q; ibytes := %q; iioutil := %q; zero := %q; one := %q; x := %q; s := fmt.Sprintf(x, ios, ifmt, ibytes, iioutil, ios, ifmt, ibytes, iioutil, zero, one, x); in, _ := ioutil.ReadAll(os.Stdin); if bytes.Equal(in, []byte(s)) {fmt.Println(one);} else {fmt.Println(zero);};}\n"; s := fmt.Sprintf(x, ios, ifmt, ibytes, iioutil, ios, ifmt, ibytes, iioutil, zero, one, x); in, _ := ioutil.ReadAll(os.Stdin); if bytes.Equal(in, []byte(s)) {fmt.Println(one);} else {fmt.Println(zero);};}
|
||||
Loading…
Add table
Add a link
Reference in a new issue