#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 namomo subsequence\textit{namomo subsequence}s of it. The word by Prof. Pang is a string ss with nn characters where each character is either an English letter (lower or upper case) or a digit. The ii-th character of ss is denoted by s[i]s[i] (1in1\le i\le n). A subsequence tt of ss is defined by a list of indices t1,,t6t_1, \ldots, t_6 such that 1t1<t2<<t6n1\le t_1 < t_2 < \ldots < t_6\le n. Let compare(c1,c2)compare(c_1, c_2) be a function on two characters such that compare(c1,c2)=1compare(c_1, c_2)=1 when c1=c2c_1=c_2 and compare(c1,c2)=0compare(c_1, c_2)=0 otherwise. tt is a namomo subsequence of ss if and only if for any 1i<j61\le i<j\le 6, $compare(s[t_i], s[t_j]) = compare(namomo[i], namomo[j])$, where namomo[x]namomo[x] represents the xx-th character of the string namomo (1x61\le x\le 6).

Output the number of namomo subsequences of a given string ss modulo 998244353998244353.

输入格式

The first line contains a string ss with nn characters (6n10000006\le n\le 1000000). ss contains only lower case English letters (a -- z), upper case English letters (A -- Z) and digits (0 -- 9).

输出格式

Output one integer -- the answer modulo 998244353998244353.

wohaha
1
momomo
0
gshfd1jkhaRaadfglkjerVcvuy0gf
73
retiredMiFaFa0v0
33