All the Borders
A border of S is a string that is both a proper prefix and a proper suffix. Print all border lengths in increasing order (or 0 if there are none).
Input: one line with the string S.
Output: the border lengths ascending, or 0.
Constraints:
- 1 ≤ |S| ≤ 106
- lowercase letters
Sample Tests
Input 1
abacaba
Output 1
1 3
Input 2
abc
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.