Created
August 28, 2016 09:22
-
-
Save k0uki/47c2513ccceca9b21fee0bc224ec2cd1 to your computer and use it in GitHub Desktop.
tour of go の例題
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 ( | |
"strings" | |
"golang.org/x/tour/wc" | |
) | |
func WordCount(s string) map[string]int { | |
result := make(map[string]int) | |
target := strings.Split(s," ") | |
for _, v := range target { | |
result[v]++; | |
} | |
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