#abc234f. F - Reordering
F - Reordering
Score : points
问题描述
给定一个字符串 。可以获得多少个不同的字符串,它们是 的非空、不必连续 子序列的排列?
由于计数可能非常大,请将结果模 后输出。
以上为通义千问 qwen-max 翻译,仅供参考。
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 .
Sample Input 1
aab
Sample Output 1
8
There are different strings that can be obtained as a permutation of a subsequence of : a
, b
, aa
, ab
, ba
, aab
, aba
, baa
.
Sample Input 2
aaa
Sample Output 2
3
Sample Input 3
abcdefghijklmnopqrstuvwxyz
Sample Output 3
149621752
Be sure to print the count modulo .
update @ 2024/3/10 10:10:34