You are going to take the entrance examination of Kyoto University tomorrow and have decided to memorize a set of strings S that is expected to appear in the examination. Since it is really tough to memorize S as it is, you have decided to memorize a single string T that efficiently contains all the strings in S.

You have already confirmed the following conditions for S and T are satisfied.

* Every string in S is a consecutive subsequence(1) in T .
* For every pair of strings x, y (x \neq y) in S , x is not a subsequence(2) of y.



Note that (1) is ''consecutive subsequence'', while (2) is ''subsequence''.

The next day, you opened the problem booklet at the examination and found that you can get a full score only if you remember S. However, You have forgot how to reconstruct S from T . Since all you remember is that T satisfies the above conditions, first you have decided to find the maximum possible number of elements in S .

Constraints

* 1 \leq |T| \leq 10^5
* T consists of only lowercase letters.



Partial points

* 30 points will be awarded for passing the test set satisfying the condition: 1 \leq |T| \leq 50 .
* Another 30 points will be awarded for passing the test set satisfying the condition: 1 \leq |T| \leq 10^3.

Input

The input is given from Standard Input in the following format:


T

The input only consists of T on one line.

Output

Print the maximum number of elements inS .

Examples

Input

abcabc


Output

3


Input

abracadabra


Output

7


Input

abcbabbcabbc


Output

8


Input

bbcacbcbcabbabacccbbcacbaaababbacabaaccbccabcaabba


Output

44
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <cassert>
#include <iostream>
#include <memory>
#include <unordered_map>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define delete(a,n) a.erase(remove(all(a),n),a.end())
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 
ll b_pow(ll x,ll n){return n ? b_pow(x*x,n/2)*(n%2?x:1) : 1ll;}
string itos(int n){stringstream ss;ss << n;return ss.str();}

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()



typedef unsigned __int128 Hash;

template<class T>
class RollingHash{
public:
	T src;
	vector<Hash> harr,p;
	
	RollingHash(T src,Hash w=8999):src(src){
		p.resize(src.size()+1);
		Hash sum = 0;
		for(int i = 0 ; i < src.size() ; i++){
			sum = sum * w + src[i];
			harr.push_back(sum);
		}
		p[0] = 1;
		for(int i = 1 ; i < p.size() ; i++){
			p[i] = p[i-1] * w;
		}

	}
	// [l,r)
	Hash sub(int l,int r) const{
		if( l >= r ) return 0;
		return harr[r-1] - (l?harr[l-1] * p[r-l]:0);
	}
};

int calc(string &s,int k){
	if( k == 0 ) return 0;

	RollingHash<string> RH(s);

	set<Hash> S;
	for(int i = 0 ; i < s.size() - k + 1 ; i++){
		S.insert(RH.sub(i,i+k));
	}
	return S.size();
}
int main(){
	string s;
	cin >> s;
	int l = 1, r = s.size();
	while( l != r ){
		int m = (l+r+1) / 2;
		if( calc(s,m) - calc(s,m-1) > 0 ){
			l = m;
		}else{
			r = m-1;
		}
	}
	cout << calc(s,l) << endl;

	/*
	for(int i = 1 ; i <= s.size() ; i++){
		cout << i << ": " << calc(s,i) << endl;
	}*/
}


