- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a string and your task is to calculate the Z-array for the string. The Z-Array for a string is an array that, for each position , stores the length of the longest substring starting from that matches a prefix of the string.
Input
The input consists of a single line containing a string , consisting of lowercase English letters.
Output
Output a single line containing integers, the values of .
Constraints
Example
Input:
aabaaab
Output:
7 1 0 2 3 1 0