F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

helloworld

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 1    Accepted Submission(s): 1


Problem Description
作为本次新生赛的第一题,出题人在此给出温馨提示:

题目难度顺序无关,判断题目难度,和写出正解一样重要。大多数选手会选择跟榜,即先做通过人数多的题目。如果一题卡了半小时以上,也许你可以考虑换一道题,避免耽误过多时间。

以上内容与本题无关,接下来是本题的题目描述

给你一个字符串$S$,$S$中只有小写英文字母,你需要计算$S$中含有多少个"helloworld"子序列,答案可能很大,请输出答案对$998244353$取模之后的结果

某个序列的子序列是指从最初序列除去部分(可能0个)元素但不破坏余下元素的相对位置而形成的新序列。如"abcde","be","acd"是"abcde"的子序列,但"cbe"不是。
 

Input
第一行一个正整数$T$($1 \leq T\leq\ 3\times 10^4$),表示有$T$组输入样例

每组样例在一行内输入一个字符串$S$($|S| \leq\ 10^5$)

对所有测试数据,保证$\sum |S|\leq 2.5\times 10^6$
 

Output
你需要在一行内输出字符串$S$有多少个"helloworld"子序列,答案可能很大,请输出答案对$998244353$取模之后的结果
 

Sample Input
5 helloworld helolworld hhelloworldd helloworldhellomarkyyzhelloworld hhhhhhhhhheeeeeeeeelllllllllllllllooooooowwwwwwwwoooooooorrrrrrrlllllllllddddddddd
 

Sample Output
1 0 4 67 403962494
 

Hint
最后一组样例的实际答案为$2400451200$,对$998244353$取模后得到$403962494$
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.001000(s) query 1, Server time : 2025-04-01 07:58:13, Gzip enabled