.. | ||
cases_test.go | ||
README.md | ||
word_count_test.go | ||
word_count.go |
Word Count
Write a program that given a phrase can count the occurrences of each word in that phrase.
For example for the input "olly olly in come free"
olly: 2
in: 1
come: 1
free: 1
To run the tests simply run the command go test
in the exercise directory.
If the test suite contains benchmarks, you can run these with the -bench
flag:
go test -bench .
For more detailed info about the Go track see the help page.
Source
This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour. view source