Counting the number of word tokens

Report a typo

Lena wants to create a Go program that uses a Scanner and counts all the words that the user enters as input.

She has written some code but is missing some crucial parts for her program to properly count each of the input words. Please help her writing the additional required code.

Sample Input 1:

You know what they call a Quarter Pounder with Cheese in Paris? "Royale with Cheese"

Sample Output 1:

15
Write a program in Go
package main

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

func main() {
scanner := bufio.NewScanner(os.Stdin)

// Set the correct split function below:
scanner.Split(?)

// Write the for loop below with the correct scanner statement
count := 0
for scanner.? {
count++
}
fmt.Println(count)
}
___

Create a free account to access the full topic