atcoder#ABC234F. [ABC234F] Reordering
[ABC234F] Reordering
Score : points
Problem Statement
Given is a string . How many different strings can be obtained as a permutation of a non-empty, not necessarily contiguous subsequence of ?
Since the count can be enormous, print it modulo .
Constraints
- is a string of length and (inclusive) consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different strings that can be obtained as a permutation of a subsequence of , modulo .
aab
8
There are different strings that can be obtained as a permutation of a subsequence of : a
, b
, aa
, ab
, ba
, aab
, aba
, baa
.
aaa
3
abcdefghijklmnopqrstuvwxyz
149621752
Be sure to print the count modulo .