#Q37. 「一本通 2.1 练习 1」Power Strings

「一本通 2.1 练习 1」Power Strings

Description

Original source: POJ 2406

Given several strings with lengths 106 \le 10^6 , determine the maximum number of identical substrings each string can be formed by concatenating. For example, ababab can be formed by concatenating 33 ab substrings.

Input Format

Input consists of several lines, each containing a string. Specifically, the string may be . (a single period), which indicates the end of input.

Sample 1

abcd
aaaa
ababab
.

1
4
3

Constraints and Hints

String length 106 \le 10^6 .