diff --git a/eBook/exercises/chapter_12/word_letter_count.go b/eBook/exercises/chapter_12/word_letter_count.go index 405200b..4e4b216 100755 --- a/eBook/exercises/chapter_12/word_letter_count.go +++ b/eBook/exercises/chapter_12/word_letter_count.go @@ -31,7 +31,6 @@ func main() { func Counters(input string) { nrchars += len(input) - 2 // -2 for \r\n - // count number of spaces, nr of words is +1 - nrwords += strings.Count(input, " ") + 1 + nrwords += len(strings.Fields(input)) nrlines++ }