Created
July 11, 2018 12:40
-
-
Save TonPC64/2f6b4997c7147ccd68afa6a712fe11d5 to your computer and use it in GitHub Desktop.
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 { | |
var strs = make(map[string]int) | |
for _, str := range strings.Fields(s) { | |
strs[str]++ | |
} | |
return strs | |
} | |
func main() { | |
wc.Test(WordCount) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment