title: Implementation of strspn( )
body: <p>The definition of library function <code>strspn</code> is:</p>
  
  <pre><code>size_t strspn(const char *str, const char *chars)
  
  /* Return number of leading characters at the beginning of the string `str`
     which are all members of string `chars`. */
  </code></pre>
  
  <p>e.g. if <code>str</code> is <code>"fecxdy"</code> and <code>chars</code> is <code>"abcdef"</code> then the function would return <code>3</code>, since <code>f</code>, <code>e</code> and <code>c</code> all appear somewhere in <code>chars</code>, giving 3 leading characters of <code>str</code>, and <code>x</code> is the first character of <code>str</code> which is not a member of <code>chars</code>.</p>
  
  <p>Could someone help me write an implementation of <code>strspn</code> in C. The only library function I am allowed to call from the implementation is <code>strlen</code>?</p>