Word Counter
Lesson 22 of 24 in Coddy's Golang Challenges - Level 1 course.
Challenge
MediumWrite a word counter program.
We have a string like this: "Learn Golang with Coddy". Write a function that counts the number of words in the string. Note that the words in the string are separated by spaces.
The function should take the input string as a parameter and return the count of words as an integer.
For example, if the input string is "Learn Golang with Coddy", the expected output should be 4, since there are four words in the string.
The function should split the input string using spaces as delimiters and count the resulting list of words.
Try it yourself
func countWords() {
}All lessons in Golang Challenges - Level 1
1Introduction
Introduction