title: How to make function of O(n) that checks for letters (upper& lower) & ()+-*/ to a tail recursion?
body: <p>I am trying to figure out how do I convert a function I made that checks for the passed string if it only contains letters (lower case or capital) and only these punctuation ()+-*/....to an efficient recursive function, possibly through a tail recursion. Here is my code:</p>
  
  <pre><code>/*typedef std::string StringElem;*/
  bool verify_input_str(StringElem str_para) {
    for (int x = 0; x &lt; str_para.size(); ++x) {
      if (!(std::isalpha(str_para[x])) &amp;&amp; (str_para[x] != '*')&amp;&amp; (str_para[x] != '/')
          &amp;&amp; (str_para[x] != '+') &amp;&amp; (str_para[x] != '-') &amp;&amp; (str_para[x] != ')')
          &amp;&amp; (str_para[x] != '(')) {
          return 0;
      }
    }
  return 1;
  }
  </code></pre>
  
  <p>Could anyone give me a hint, I would really appreciate it. Thanks, looking forward to your suggestions.</p>