Count how many different contiguous substrings appear in the given lowercase string of length up to 1,000,000.
Given a string SSS, write a program that counts how many distinct substrings SSS has.
A substring is a contiguous piece cut out of SSS, and its length must be at least 1.
For example, if SSS is ababc, the substrings are a, b, a, b, c, ab, ba, ab, bc, aba, bab, abc, abab, babc, ababc, and 12 of them are distinct.
The first line contains the string SSS. SSS consists of lowercase letters only, and its length is at least 1 and at most 1,000,000.
Print the number of distinct substrings of SSS on the first line.