Milo has a string S of length L. Tutu picks a random prefix and Mota picks a random suffix of S.
Now, Chotku is given a task of concatenating the two strings that Tutu and Mota have chosen, in respective order. Chotku wonders, how many distinct prefix-suffix concatenation is possible out there of string S.
So you know what to do.. Help Chotku!
Input file contains several lines of text. Each line contains a string, S. End of file marks the end of input.
Constraints:
Output one integer per string, denoting the number of distinct prefix-suffix concatenation of the string.
Input | Output |
---|---|
abc aab | 8 7 |
For the first input in the sample, the 3 prefixes are “a”, “ab”, “abc”. The 3 suffixes are “c”, “bc”, “abc”. And, the 8 distinct concatenations are, “ac”, “abc”, “aabc”, “abbc”, “ababc”, “abcc”, “abcbc”, “abcabc”.