#P6832. [Cnoi2020] 子弦

[Cnoi2020] 子弦

Problem Description

Cirno has a string S\texttt{S}, and wants you to find the maximum number of occurrences among all non-empty substrings of S\texttt{S}. Denote this number as pp.

Input Format

One line, a string S\texttt{S}.

Output Format

One line, an integer pp.

abababab
4

Hint

Constraints and Notes

For 100%100\% of the testdata, it is guaranteed that: 0<S1070 < |\texttt{S}| \le 10^7, and Sx[a,z]\texttt{S}_x \in [\texttt{a},\texttt{z}].

Subtasks (this problem uses bundled tests)

  • Subtask 1 (40%40\%): S100|\texttt{S}| \le 100.
  • Subtask 2 (40%40\%): S105|\texttt{S}| \le 10^5.
  • Subtask 3 (20%20\%): no special constraints.

Glossary

  • Substring: A subsequence consisting of any number of consecutive characters in a string is called a substring of that string.

Translated by ChatGPT 5