code: func TotalWords(s string) int {
  	n := 0
  	inWord := false
  	for _, r := range s {
  		wasInWord := inWord
  		inWord = !unicode.IsSpace(r)
  		if inWord && !wasInWord {
  			n++
  		}
  	}
  	return n
  }
docs: // TotalWords counts instance of one or more consecutive white space
  // characters, as defined by unicode.IsSpace, in s.
  // This is a cheaper way of word counting than the obvious len(strings.Fields(s)).