Hello guys,↵
↵
Is there any way to find the shortest period of a string using Z algorithm. I know of one using KMP. ↵
↵
EDIT:↵
↵
Sorry for stating the question wrongly.↵
↵
I was solving [this](http://mirror.codeforces.com/contest/825/problem/F). So the point where i got struck was: given a string, find shortest period for each prefix. Can this be solved by Z-algorithm in linear time? And also is there a way to transform Z array to LPS array and vice-versa? ↵
↵
↵
Thanks in advance,↵
↵
Shivram↵
↵
↵
UPDATE: SOLVED↵
↵
[Method](http://mirror.codeforces.com/blog/entry/3107?#comment-83420)↵
↵
This converts Z to LPS. After that we can use the editorial method.↵
↵
Is there any way to find the shortest period of a string using Z algorithm. I know of one using KMP. ↵
↵
EDIT:↵
↵
Sorry for stating the question wrongly.↵
↵
I was solving [this](http://mirror.codeforces.com/contest/825/problem/F). So the point where i got struck was: given a string, find shortest period for each prefix. Can this be solved by Z-algorithm in linear time? And also is there a way to transform Z array to LPS array and vice-versa? ↵
↵
↵
Thanks in advance,↵
↵
Shivram↵
↵
↵
UPDATE: SOLVED↵
↵
[Method](http://mirror.codeforces.com/blog/entry/3107?#comment-83420)↵
↵
This converts Z to LPS. After that we can use the editorial method.↵