box-o-sand/gotime/gotour-artifacts/exercise-maps/main.go
Dan Buch 44999623da Collapsing tree into more sane Go project layout
since I was in here looking at something unrelated...
2012-12-13 18:12:43 -05:00

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)
}