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

PROGRAMMING:Good prefix

Luz5年前 (2021-05-10)题库356
We call the prefix of a string a good prefix 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 the good prefix length of a string. Note that a string cannot be called its own prefix.
###Input format:
The input is a string containing no more than $$10 ^ {5} $$letters.
###Output format:
The output is an integer representing the length of a good prefix for the input string.
###Input sample 1:
```in
abcabce
```
###Output sample 1:
```out
three
```
###Input sample 2:
```in
ababaxxy
```
###Output sample 2:
```out
three
```







answer:If there is no answer, please comment