1
0

exercise 2

This commit is contained in:
Stephen M. McQuay 2012-08-02 14:45:27 -06:00
parent 27d19a27c8
commit e99ca5c8fa

18
exercise01/go.go Normal file
View File

@ -0,0 +1,18 @@
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)
}