how to find the number of distinct subsequences of a string?

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

How can I solve this problem ?

39
задан iCodez 21 January 2015 в 23:05
поделиться