"ace" is a subsequence of "abcde", while "aec" is not.
Given a string letters, count how many **different non-empty** strings appear among its subsequences. The answer can be huge, so return it modulo 10⁹ + 7.letters="xyz" → 7
All 7 non-empty subsequences are different: x, y, z, xy, xz, yz, xyz.
letters="pop" → 6
The distinct ones are p, o, po, pp, op, pop, six in total ("p" can be picked in two ways but counts once).
letters="bbbb" → 4
letters) ≤ 2000letters consists of lowercase English lettersletters="xyz"
7
Run checks the first 3 tests in your browser. Submit checks all 56 tests on the server, hidden ones included.