package main

//This covers "Exercise: Maps"

import (
	"golang.org/x/tour/wc"
	"strings"
)

func WordCount(s string) map[string]int {
	result := make(map[string]int)
	words := strings.Fields(s)
	
	for x := 0; x < len(words); x++ {
		if _, ok := result[words[x]]; ok {
			result[words[x]]++
		} else {
			result[words[x]] = 1
		}		
	}
	
	return result
}

func main() {
	wc.Test(WordCount)
}