Update word_letter_count.go

This commit is contained in:
marekchen
2016-12-21 19:44:34 +08:00
committed by GitHub
parent 982f6b1abd
commit 2838c9476b

View File

@@ -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 += len(strings.Split(strings.Trim(input, " \n")," "))
nrwords += len(strings.Fields(input))
nrlines++
}