cswork / OA打开练习工作台

NutanixOA #1

Good Subsequences

估计中等可在线判题

考点(AI 标注)位运算哈希计数

Count the non-empty subsequences in which every character that appears has the same frequency, modulo 1,000,000,007. Choosing the same character from different indices gives different subsequences.

The standard input/output format and any supplementary ranges on this site are as defined in this problem statement.

输入格式

One line containing word, consisting only of lowercase English letters; this site adds 1≤|word|≤200000 to fill in the length upper bound the original problem did not give.

输出格式

Output the number of qualifying non-empty subsequences modulo 1,000,000,007.

样例 1

输入:

abca

输出:

12

样例 2

输入:

abcd

输出:

15

样例 3

输入:

aaa

输出:

7