Score : $500$ points
Given is a string $S$. How many different strings can be obtained as a permutation of a non-empty, not necessarily contiguous subsequence of $S$?
Since the count can be enormous, print it modulo $998244353$.
Input is given from Standard Input in the following format:
$S$
Print the number of different strings that can be obtained as a permutation of a subsequence of $S$, modulo $998244353$.
aab
8
There are $8$ different strings that can be obtained as a permutation of a subsequence of $S$: a
, b
, aa
, ab
, ba
, aab
, aba
, baa
.
aaa
3
abcdefghijklmnopqrstuvwxyz
149621752
Be sure to print the count modulo $998244353$.