For each prefix of a given string S with N characters , we want to know whether the prefix is a periodic string. That is, for each i we want to know the largest K > 1 such that the prefix of S with length i can be written as AK ,that is A concatenated K times, for some string A. Of course, we also want to know the period K.
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2≤i≤N)(2 leq i leq N)(2≤i≤N)we want to know the largest K > 1 (if there is one) such that the prefix of S with length i can be written as AK ,that is A concatenated K times, for some string A. Of course, we also want to know the period K.
(图片来源网络,侵删)