atcoder#ABC285B. [ABC285B] Longest Uncommon Prefix
[ABC285B] Longest Uncommon Prefix
Score : points
Problem Statement
You are given a string of length consisting of lowercase English letters. The -th character of is .
For each , find the maximum non-negative integer that satisfies all of the following conditions:
- , and
- for all integers such that , it holds that .
Note that always satisfies the conditions.
Constraints
- is an integer such that .
- is a string of length consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer as an integer when .
6
abcbac
5
1
2
0
1
In this input, abcbac
.
- When , we have , and , so the maximum value is .
- When , we have but , so the maximum value is .
- When , we have and but , so the maximum value is .
- When , we have , so the maximum value is .
- When , we have , so the maximum value is .