QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100

#4844. 正向字符串

統計

Grammy 对字符串有着独特的见解。她认为一个字符串是“正向的”(positive),当且仅当它在字典序上大于它的反转。

现在给定一个字符串,请找出它有多少个连续子串是根据 Grammy 的见解定义的“正向”字符串。

输入格式

输入包含一行字符串 $S$ ($1 \le |S| \le 200\,000$),仅由小写英文字母组成。

输出格式

输出一个整数,表示 $S$ 中“正向”子串的数量。

样例

输入 1

jjikkollp

输出 1

4

输入 2

pbpbppb

输出 2

7

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.