#abc347b. B - Substring

    ID: 3993 传统题 1000ms 256MiB 尝试: 1 已通过: 1 难度: 10 上传者: 标签>来源atcoderC++语法高级字符串基础算法枚举STLset字符串函数字符串哈希

B - Substring

Score: 200200 points

问题陈述

给定一个由小写英文字母组成的字符串 SSSS 有多少个不同的非空子串?

子串是连续的子序列。例如,xxxyxxxy 的子串,但不是 xxyxx 的子串。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given a string SS consisting of lowercase English letters. How many different non-empty substrings does SS have?

A substring is a contiguous subsequence. For example, xxx is a substring of yxxxy but not of xxyxx.

Constraints

  • SS is a string of length between 11 and 100100, inclusive, consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

SS

Output

Print the answer.

Sample Input 1

yay

Sample Output 1

5

SS has the following five different non-empty substrings:

  • a
  • y
  • ay
  • ya
  • yay

Sample Input 2

aababc

Sample Output 2

17

Sample Input 3

abracadabra

Sample Output 3

54