CSES - Finding Borders
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
A border of a string is a prefix that is also a suffix of the string but not the whole string. For example, the borders of abcababcab are ab and abcab.
Your task is to find all border lengths of a given string.
Input
- The only input line has a string of length ~n~ consisting of characters a–z.
Output
- Print all border lengths of the string in increasing order.
Constraints
- ~1 \le n \le 10^6~
Example Input
abcababcab
Example Output
2 5
Bình luận