blob: 6a1eee09504c951571508a148445e8b4acd5c190 [file] [log] [blame]
// +build OMIT ignore
// 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"
"golang.org/x/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)
}