Skip to content

Instantly share code, notes, and snippets.

@laprasdrum
Created May 8, 2014 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laprasdrum/9d39ada7947401896e1e to your computer and use it in GitHub Desktop.
Save laprasdrum/9d39ada7947401896e1e 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 {
seperate := strings.Split(s, " ")
result := make(map[string]int)
for i:= range seperate {
result[ seperate[i] ] += 1
}
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