title: How do I count the number of words if the user enters multiple lines/spaces?
body: <p>I have a char array, which contains what the user has inputted. How would I count the words?
  The user in permitted to to do something crazy like:</p>
  
  <pre><code>hello this
                 is a test
     how are
  you today?
  </code></pre>
  
  <p>So the number of words here should be 9 but my program tells me 23. Why is this not working? Its counting the spaces, but I have taken that into account with <code>sentence_entered[i + 1] != ' '</code></p>
  
  <p>My code:</p>
  
  <pre><code>int i = 0;    
  while (sentence_entered[i] != '\0') {
  
          if (
              (sentence_entered[i] == ' ' ||
              sentence_entered[i] == '\n') &amp;&amp;
              (sentence_entered[i + 1] != ' ' ||
              sentence_entered[i + 1] != '\n')
             ) {
              words += 1;
      }
  i++
  }
  </code></pre>