Your school runs a computer that serves as the web server for its institutional site, the staff's personal pages, research-group sites, course pages, and many others.
Recently the hard disk's file table was corrupted, so the organization of every file was lost, and there are no backups. The only hope is to scan the entire disk and figure out which parts belong to each file. Luckily, the file system stored every file as one contiguous block of bytes, so only contiguous pieces of data need to be inspected.
The disk data is a sequence of bytes. Each byte can hold one of 64 different characters: an English letter (lowercase and uppercase are distinct), a decimal digit, a point ., or a comma ,.
The file system also kept several copies of each file, so a contiguous piece of bytes can be a file only if it is repeated. For each repeated piece, only one copy needs to be checked. For example, in the data ababcabb the contiguous pieces a, b, and ab are repeated, but nothing containing c, nor ba, nor bb, is repeated. So $3$ pieces of contiguous bytes need checking.
Write a program that computes exactly how many pieces need checking, that is, the number of distinct contiguous substrings that appear at least twice in the data.
The input contains several test cases. Each test case is given on exactly one line: a non-empty string of at most $10^5$ characters that represents the disk data. Every character is a lowercase letter, an uppercase letter, a digit, a point ., or a comma ,. The last test case is followed by a line containing a single asterisk *.
For each test case, print a single line with one integer: the number of distinct contiguous substrings that appear at least twice in that test case's string.