<aside> 💡 Happy gopher~
</aside>
func WordCount(s string) map[string]int {
cntMap := make(map[string]int)
strs := strings.Fields(s)
for _, s := range strs {
i := cntMap[s]
cntMap[s] = i + 1
}
return cntMap
}
strs := strings.Fields(s)
for _, s := range strs {
// xxx
}
// 如下是非法的.
y := x++
//
x++
y = x
<aside> 💡 如何遍历map
</aside>