Skip to content

Instantly share code, notes, and snippets.

@k0uki
Created August 28, 2016 09:22
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 k0uki/47c2513ccceca9b21fee0bc224ec2cd1 to your computer and use it in GitHub Desktop.
Save k0uki/47c2513ccceca9b21fee0bc224ec2cd1 to your computer and use it in GitHub Desktop.
tour of go の例題
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