1
0
gotour-notes/exercise01/go.go
Stephen M. McQuay e99ca5c8fa exercise 2
2012-08-02 14:45:27 -06:00

19 lines
244 B
Go

package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
wc := make(map[string]int)
for _, v := range strings.Fields(s) {
wc[v] += 1
}
return wc
}
func main() {
wc.Test(WordCount)
}