-->
当前位置:首页 > 题库

PROGRAMMING:good-suffix

Luz5年前 (2021-05-10)题库475
We call a suffix of a string a good suffix if it satisfies the following conditions:
(1) It appears at least twice in the string;
(2) The longest one satisfying condition (1).
Please write a program to calculate a string of good suffix length, note that a string can not be called its own suffix.
###Input format:
The input is a string containing no more than $$10 ^ {5} $$letters.
###Output format:
The output is an integer indicating the length of the good suffix of the input string.
###Input sample 1:
```in
xacbacba
```
###Output sample 1:
```out
four
```
###Input sample 2:
```in
yxxabacaba
```
###Output sample 2:
```out
three
```
###Input sample 3:
```in
abc
```
###Output sample 3:
```out
0
```







answer:If there is no answer, please comment