Reader with a certain delimiter

Report a typo

Suppose you want to create a Go program that takes as the first input a certain delimiter and then a string. Afterwards, the program should output the string, including the delimiter.

To do this, you'll need to use a Reader; we've already created it and written part of the code for you. Your task is to use the correct Reader functions that take as an argument a delimiter and then output the string.

Sample Input 1:

y
Krabby Patty

Sample Output 1:

Krabby
Write a program in Go
package main

import (
"bufio"
"fmt"
"log"
"os"
)

func main() {
reader := bufio.NewReader(os.Stdin)

// This line reads the custom delimiter; do not delete it!
var delimiter byte
fmt.Scanf("%c", &delimiter)

// What Reader functions take a 'delimiter' as an argument?
s, err := reader.?(?)
if err != nil {
log.Println(err)
}
// Output the string below
fmt.Println(?)
}
___

Create a free account to access the full topic