#P6832. Most Frequent Substring Count

    ID: 20039 Type: Default 1000ms 256MiB

Most Frequent Substring Count

Most Frequent Substring Count

Cirno has a string \(\texttt{S}\) and wants you to compute \(p\), defined as the number of occurrences of the most frequent non-empty substring in \(\texttt{S}\). Note that overlapping occurrences count. For example, if \(\texttt{S = aaa}\), the substring "a" appears 3 times, so \(p = 3\).

inputFormat

The input consists of a single line containing the string \(\texttt{S}\) (\(1 \leq |\texttt{S}| \leq 1000\)).

outputFormat

Output a single integer \(p\), the maximum frequency among all non-empty substrings of \(\texttt{S}\).

sample

aaa
3