title: How to count number of words from String using shell
body: <p>I want to count number of words from a String using Shell.</p>
  
  <p>Suppose the String is:</p>
  
  <pre><code>input="Count from this String"
  </code></pre>
  
  <p>Here the delimiter is space <code>' '</code> and expected output is 4.
  There can also be trailing space characters in the input string like <code>"Count from this String "</code>.</p>
  
  <p>If there are trailing space in the String, it should produce the same output, that is 4. How can I do this?</p>