title: Counting in Wonderland
body: <p>The <a href="http://www.gutenberg.org/cache/epub/11/pg11.txt">text of <em>Alice in Wonderland</em></a> contains the word 'Wonderland' 8 times. (Let's be case-insensitive for this question). </p>
  
  <p>However it contains the word many more times if you count non-contiguous <em>subsequences</em> as well as substrings, eg.</p>
  
  <blockquote>
    <p>Either the well was very deep, or she fell very slowly, for she had
    plenty of time as she went down to look about her and to <strong>WONDER</strong> what was
    going to happen next. First, she tried to <strong>L</strong>ook down <strong>AND</strong> make out what
    she was coming to, but it was too dark to see anything; </p>
  </blockquote>
  
  <p>(A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. —Wikipedia)</p>
  
  <p>How many times does the book contain the word Wonderland as a subsequence? I expect this will be a big number—it's a long book with many w's and o's and n's and d's.</p>
  
  <p>I tried brute force counting (recursion to make a loop 10 deep) but it was too slow, even for that example paragraph.</p>