QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#7416. 语法检查

统计

CauchySheep 有一个字符串 $s$。

他观察了该字符串所有不同的非空子串,并建立了一个有向图:如果 $|b| + 1 = |a|$ 且 $b$ 是 $a$ 的子串,则从 $a$ 到 $b$ 连一条有向边。

你需要计算该图中从 $s$ 出发的简单路径数量,结果对 $998\,244\,353$ 取模。

输入

输入的第一行包含一个由小写拉丁字母组成的字符串 $s$ ($1 \le |s| \le 300\,000$)。

输出

输出一个整数:CauchySheep 的图中从 $s$ 出发的简单路径数量,对 $998\,244\,353$ 取模。

样例

输入格式 1

abba

输出格式 1

13

输入格式 2

benbeipo

输出格式 2

255

输入格式 3

iqiiiiiiqq

输出格式 3

300

输入格式 4

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

输出格式 4

35

说明

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.