title: Counting substring that begin with character 'A' and ends with character 'X'
body: <p>PYTHON QN:
  Using just one loop, how do I devise an algorithm that counts the number of substrings that begin with character <code>A</code> and ends with character <code>X</code>? For example, given the input string <code>CAXAAYXZA</code> there are four substrings that begin with <code>A</code> and ends with <code>X</code>, namely: <code>AX</code>, <code>AXAAYX</code>, <code>AAYX</code>, and <code>AYX</code>.</p>
  
  <p>For example:</p>
  
  <pre><code>&gt;&gt;&gt;count_substring('CAXAAYXZA')
  4
  </code></pre>