blob: 5c64f46f84472b7c4d80b26f9ac0480142153c9e [file] [log] [blame]
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"strings"
"tour/wc"
)
func WordCount(s string) map[string]int {
m := make(map[string]int)
for _, f := range strings.Fields(s) {
m[f]++
}
return m
}
func main() {
wc.Test(WordCount)
}