Skip to content

Instantly share code, notes, and snippets.

@kakkun61
Created July 11, 2013 11:31
Show Gist options
  • Save kakkun61/5974664 to your computer and use it in GitHub Desktop.
Save kakkun61/5974664 to your computer and use it in GitHub Desktop.
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
tab := make(map[string]int)
for _, w := range strings.Fields(s) {
tab[w]++
}
return tab
}
func main() {
wc.Test(WordCount)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment