Skip to content

Instantly share code, notes, and snippets.

@alq666
Created December 25, 2012 23:56
Show Gist options
  • Save alq666/4376545 to your computer and use it in GitHub Desktop.
Save alq666/4376545 to your computer and use it in GitHub Desktop.
package main
import (
"tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
words := strings.Fields(s)
result := make(map[string]int)
for _, w := range words {
result[w]++
}
return result
}
func main() {
wc.Test(WordCount)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment