#include<bits/stdc++.h>
#define ll long long
const int nmax=3001;
using namespace std;
deque<ll> ar2;
ll n,k,t,ans,ilv,ansi;
char ar[nmax];
void resi(char nz[],int l,int r)
{
	bool g=false;
	int pl=l,pr=r,val=0,clrt=0,pnpx;
	for(int j=1;j<r-l;j++)
	{
	for(int i=l;i<r-j;i+=j)
	{
		if(ar[i]==ar[i+j])val++;
		else val=0;
		if(val==j){
			pr=i+1;
			pl=i-j;
			clrt=j;
			ans+=pr-pl;
			g=true;
			break;
		}
	}
	}
	if(g)resi(nz,pr,r);
}
int main()
{
	cin >> ar;
	n= strlen(ar);
	resi(ar,0,n);
	if(ans)cout << ans;
	else cout << ansi;
}