1015: 湖南省第十八届大学生计算机程序设计竞赛(HNCPC2022) - Semilive

开始时间Start Time
2023-04-02 14:30:00
结束时间End Time
2023-04-02 19:30:00
当前时间Current Time
2026-05-06 22:32:00
比赛状态Contest Status
比赛类型Contest Type
公开Public
榜单状态Rank Status
公告 Announcement
暂无公告No announcement

K (1199) : Substrings Same as Prefix

时间限制Time Limit 1 Sec 内存限制Memory Limit 128 MB 提交次数Submitted 256 Times 通过次数Solved 67 Times 标准评测Standard Judge

题目描述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, 3a”s, 2aa”s and 1aaa” are non-prefix substrings same as prefix. Then the score is 3+4+3=10.