package wordcount import ( "strings" "unicode" ) const testVersion = 2 // Use this return type. type Frequency map[string]int func normalize(s string) string { var ret []rune for _, r := range s { if unicode.In(r, unicode.Letter, unicode.Number, unicode.Space) { ret = append(ret, unicode.ToLower(r)) } } return string(ret) } // Just implement the function. func WordCount(phrase string) Frequency { wc := make(Frequency) for _, v := range strings.Fields(normalize(phrase)) { wc[v]++ } return wc }