luogu#P10816. [EC Final 2020] Namomo Subsequence
[EC Final 2020] Namomo Subsequence
题目描述
gshfd1jkhaRaadfglkjerVcvuy0gf
said Prof. Pang.
To understand Prof. Pang's word, we would like to calculate the number of s of it. The word by Prof. Pang is a string with characters where each character is either an English letter (lower or upper case) or a digit. The -th character of is denoted by (). A subsequence of is defined by a list of indices such that . Let be a function on two characters such that when and otherwise. is a namomo subsequence of if and only if for any , $compare(s[t_i], s[t_j]) = compare(namomo[i], namomo[j])$, where represents the -th character of the string namomo
().
Output the number of namomo subsequences of a given string modulo .
输入格式
The first line contains a string with characters (). contains only lower case English letters (a
-- z
), upper case English letters (A
-- Z
) and digits (0
-- 9
).
输出格式
Output one integer -- the answer modulo .
题目大意
给你一个串 ,问你有多少个长度为 且形如 的子序列。
,字符集大小 。
wohaha
1
momomo
0
gshfd1jkhaRaadfglkjerVcvuy0gf
73
retiredMiFaFa0v0
33