Open hic003cih opened 4 years ago
package main import ( "golang.org/x/tour/wc" "strings" ) func WordCount(s string) map[string]int { words = strings.Fields(s) m :=make([string] int) for _,word = range words { _,ok := m[word] if ok == false{ m[word] = 1 }else{ m[word]++ } } return map[string]int{"x": 1} } func main() { wc.Test(WordCount) }