Nun Heh Heh Aaaaaaaaaaa

TimeLimit:1000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

Vasily Tadokorov is a stringologist. He thinks a string is fragrant if it can be divided into two parts ― $\texttt{nunhehheh}$ as the prefix and a number of (excluding 0) a as the suffix. For example, nunhehhehaaaaaa is fragrant, but nunhehheh and nunhehhehoooaaa are not fragrant.

Today Vasily Tadokorov has some strings consisting of lowercase English letters. For each string, he wants to know how many subsequences of this string are fragrant. A string a is a subsequence of a string b if a can be obtained from b by deletion of several (including 0) characters.

Input
The first line contains an integer $T\ (1 \leq T \leq 1000)$, denoting the number of strings.

Each of the next $T$ lines contains a string $S\ (1 \leq |S| \leq 10^5)$ consisting of lowercase English letters.

The total length of the strings in the input will not exceed $10^6$.
Output
For each of the given $T$ strings, output the answer modulo $998244353$.
SampleInput
2
nunhehhehahaahahahahahahaahaahahahahha
nunhehhehhehhahaahahahaahaahahaaaahaa
SampleOutput
114514
1919810
Submit
题目统计信息详细
总AC数2
通过人数2
尝试人数2
总提交量2
AC率100.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: