title: how to find the number of distinct subsequences of a string?
body: <p>Here is another <a href="http://www.spoj.pl/problems/DSUBSEQ/">spoj problem</a> that asks how to find the number of distinct subsequences of a string ?</p>
  
  <p>For example,</p>
  
  <blockquote>
    <p><strong>Input</strong> <br>
    AAA <br>
    ABCDEFG <br>
    CODECRAFT <br></p>
    
    <p><strong>Output</strong> <br> 4 <br> 128 <br> 496 <br></p>
  </blockquote>
  
  <p>How can I solve this problem ?</p>