This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "https://judge.yosupo.jp/problem/zalgorithm"
#include "template.hpp"
#include "string/z-algorithm.hpp"
int main(){
string s;
cin >> s;
for(auto x:z_algorithm(s))cout << x << " ";
}
#line 1 "verify/yosupo/string/zalgorithm.test.cpp"
#define PROBLEM "https://judge.yosupo.jp/problem/zalgorithm"
#line 1 "template.hpp"
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using db = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<db>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<db,db>;
const int INF=INT_MAX/2;
const int MOD=998244353;
const int MOD2=1000000007;
const ll LINF=LLONG_MAX/2;
const db DINF=numeric_limits<db>::infinity();
const db EPS=1e-9;
const db PI=acos(db(-1));
template<class T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>
using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
#line 2 "string/z-algorithm.hpp"
/**
* Author: Teetat T.
* Date: 2024-06-14
* Description: Z Algorithm. z[i] := the length of the longest common prefix between s and s[i:].
*/
template<class STR>
vector<int> z_algorithm(const STR &s){
int n=(int)s.size();
vector<int> z(n);
z[0]=n;
for(int i=1,l=0,r=1;i<n;i++){
if(i<r)z[i]=min(r-i,z[i-l]);
while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;
if(i+z[i]>r)l=i,r=i+z[i];
}
return z;
}
#line 4 "verify/yosupo/string/zalgorithm.test.cpp"
int main(){
string s;
cin >> s;
for(auto x:z_algorithm(s))cout << x << " ";
}