Here is another spoj problem that asks how to find the number of distinct subsequences of a string ?
For example,
Input AAA ABCDEFG CODECRAFT Output 4 128 496
Input AAA ABCDEFG CODECRAFT
Output 4 128 496
How can I solve this problem ?