1199 : Substrings Same as Prefix

时间限制Time Limit
1 秒Sec
内存限制Memory Limit
128 兆MB
提交次数Submitted
1,339 次Times
通过次数Solved
359 次Times

题目描述Description

We want to know how similar the content of a string is to its prefix. A string could gain a score of k when there is a non-prefix substring of length k that is the same as its prefix. Find the total score for a string.

输入格式Input

There are 20 test cases. Each case contains a string of English letters with length n.

\(1 \leq n \leq 10^5\)

输出格式Output

Each case one line, the score of the string.

样例Sample

提示Hint

For the first case, “a”, “ab”, “abc” are non-prefix substrings same as prefix and the score is 1+2+3=6.

For the second case, 3 “a”s, 2 “aa”s and 1 “aaa” are non-prefix substrings same as prefix. Then the score is 3+4+3=10.

出题Author

CSGrandeur