• + 5 comments

    I tried to do this one with go. I could not figure out how to use the fmt.Scan functions to read a whole line of text from stdin so I used the os pkg:

    package main

    import ( "fmt" "os" )

    func main() {
    s := make([]byte, 1200) os.Stdin.Read(s)

    fmt.Println("Hello World")
    fmt.Printf("%s\n", s)  
    

    }

    But the test is failing because the second line of output has a newline before the last two characters.

    Are there any go experts out there that got fmt.Scan to work?

    Any ideas how the second line of output got a newline inserted in it?