Created
May 8, 2014 12:02
-
-
Save laprasdrum/9d39ada7947401896e1e to your computer and use it in GitHub Desktop.
ʕ◔ϖ◔ʔ
From http://go-tour-jp.appspot.com/#41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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