21 lines
348 B
Go
21 lines
348 B
Go
package main
|
|
|
|
import "fmt"
|
|
import "os"
|
|
import "strings"
|
|
|
|
func wc(text string) map[string]uint {
|
|
words := make(map[string]uint)
|
|
for _, word := range strings.Fields(text) {
|
|
words[word]++
|
|
}
|
|
return words
|
|
}
|
|
|
|
func main() {
|
|
input := strings.Join(os.Args[1:], " ")
|
|
fmt.Println(input)
|
|
fmt.Println(strings.Repeat("-", 80))
|
|
fmt.Println(wc(input))
|
|
}
|