#if 1
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <functional>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#include <sstream>
#include <iostream>
#include <bitset>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int , int> pii;
typedef vector <int> veci;
typedef vector <veci> graph;
const LD eps = 1e-9;
const LD pi = acos(-1.0);
const int inf = 1000 * 1000 * 1000;
const LL inf64 = LL(inf) * inf;

#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define iss istringstream
#define oss ostringstream
#define dbg(x) {cerr << #x << " = " << x << endl;}
#define dbgv(x) {cerr << #x << " ={"; for (int _i = 0; _i < x.size(); _i++) {if (_i) cerr << ", "; cerr << x[_i];} cerr << "}" << endl;}
#define NAME "problem"
#define hash xhash

const int maxn = 200011;

// SUFFIX ARRAY O(n*log(n))
struct suf_array_t {
	static const int maxn = 200011; // maxn > |alphabet|
	static const int maxa = 256;
	static const int maxlg = 19;
	string s;
	int sa[maxn], c[maxn], cnt[maxn];
	int pos[maxn], npos[maxn], nc[maxn];
	int lcp[maxn];
	int allc[maxlg][maxn];//*
	int lg, n;
	static int code(char c) { return (unsigned int)c; }
	void build(const string &t) {
		s = t;
		s += "$";
		n = s.size();
		memset(cnt, 0, sizeof(cnt[0]) * maxa);
		for(int i = 0; i < n; ++i)
			cnt[code(s[i])]++;
		for(int i = 1; i < maxa; ++i)
			cnt[i] += cnt[i - 1];
		for(int i = 0; i < n; ++i)
			pos[--cnt[code(s[i])]] = i;
		c[pos[0]] = 0;
		for(int i = 1; i < n; ++i)
			c[pos[i]] = c[pos[i - 1]] + (s[pos[i]] != s[pos[i - 1]]);
		memcpy(allc[0], c, sizeof(c[0]) * n);//*
		lg = 1;
		for(int len = 1; len < n; len <<= 1, ++lg) {
			memset(cnt, 0, sizeof(cnt[0]) * n);
			memcpy(npos, pos, sizeof(pos[0]) * n);
			for(int i = 0; i < n; ++i)
				npos[i] -= len - (pos[i] < len ? n : 0);
			for(int i = 0; i < n; ++i)
				cnt[c[npos[i]]]++;
			for(int i = 1; i < n; ++i)
				cnt[i] += cnt[i - 1];			
			for(int i = n - 1; i >= 0; --i)
				pos[--cnt[c[npos[i]]]] = npos[i];
			nc[pos[0]] = 0;
			for(int i = 1; i < n; ++i)
				nc[pos[i]] = nc[pos[i - 1]] +
					(mp(c[pos[i]], c[(pos[i] + len) % n]) !=
					 mp(c[pos[i - 1]], c[(pos[i - 1] + len) % n]));
			memcpy(c, nc, sizeof(c[0]) * n);
			memcpy(allc[lg], c, sizeof(c[0]) * n);//*
		}
		memcpy(sa, pos, sizeof(pos[0]) * n);
	}


	void build_lcp() {
		for(int i = 0; i < n; ++i)
			pos[sa[i]] = i;

		for(int i = 0, h = 0; i < n; ++i)
			if(pos[i] < n - 1) {
				int j = sa[pos[i] + 1];
				while(s[i + h] == s[j + h]) h++;
				lcp[pos[i]] = h;
				if(h) h--;
			}	
	}

	
	pii get(int l, int r, int k)
	{ return mp(allc[k][l], allc[k][r - (1<<k) + 1]); }

	int get_lcp(int i, int j) {
		int ans = 0;
		for(int k = lg - 1; k >= 0; --k)
			if(allc[k][i] == allc[k][j]) {
				ans += 1 << k;
				i += 1 << k;
				j += 1 << k;
			}
		return ans;
	}	
};

suf_array_t sa;
char s[maxn];
int gleft[maxn];
int gright[maxn];
int n;

int get_lcp(int a, int b)
{
	return sa.get_lcp(a, b);
}
		
void precalc_greater()
{
	memset(gleft, -1, sizeof gleft);
	vector<int> st;
	for(int i = 0; i <= n; ++i)
	{
		while(st.size() && st.back() < sa.sa[i])
			st.pop_back();
		if(st.size())
			gleft[sa.sa[i]] = st.back();
		st.push_back(sa.sa[i]);
	}
	
	st.clear();
	memset(gright, -1, sizeof gright);
	for(int i = n; i >= 0; --i)
	{
		while(st.size() && st.back() < sa.sa[i])
			st.pop_back();
		if(st.size())
			gright[sa.sa[i]] = st.back();
		st.push_back(sa.sa[i]);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);

	assert(scanf("%s", s) == 1);
    n = strlen(s);
	reverse(s, s + n);
	sa.build(s);

	precalc_greater();

	LL cur = 0;
	for(int i = n - 1; i >= 0; --i)
	{
		int max_len = 0;
		if(gleft[i] != -1)
			max_len = max(max_len, get_lcp(i, gleft[i]));
		if(gright[i] != -1)
			max_len = max(max_len, get_lcp(i, gright[i]));
		cur += n - i - max_len;

		cout << cur << "\n";
	}

	return 0;
}
/*************************
*************************/
#endif