P3804 【Template】Suffix Automaton (SAM)

Description

Given a string $S$ consisting only of lowercase letters. Please find the maximum value of (occurrence count of a substring) multiplied by (the length of that substring) over all substrings of $S$ whose occurrence count is not $1$.

Input Format

One line containing a string $S$ consisting only of lowercase letters.

Output Format

A single integer, the required answer.

Explanation/Hint

Constraints: - For $10\%$ of the testdata, $\lvert S \rvert \le 1000$. - For $100\%$ of the testdata, $1 \le \lvert S \rvert \le {10}^6$. - 2023.7.30: Added a set of hack testdata. Translated by ChatGPT 5