44999623da
since I was in here looking at something unrelated...
20 lines
275 B
Go
20 lines
275 B
Go
package main
|
|
|
|
import (
|
|
"code.google.com/p/go-tour/wc"
|
|
"strings"
|
|
)
|
|
|
|
func WordCount(s string) map[string]int {
|
|
counts := make(map[string]int)
|
|
words := strings.Fields(s)
|
|
for _, word := range words {
|
|
counts[word]++
|
|
}
|
|
return counts
|
|
}
|
|
|
|
func main() {
|
|
wc.Test(WordCount)
|
|
}
|