// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 123456789012345678LL
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
using namespace std;
// mylittledoge

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int N =s.length();
	set< pair<long long, long long> > S[2000];
	for(int a =1; a <= N; a++) for(int b =a+1; b <= N; b++) {
		long long h1 =0, h2 =0;
		int x =a, y =b, l =0;
		while(x <= N) {
			l++;
			int a =s[x-1]-'a'+1;
			if(s[x-1] >= '0' && s[x-1] <= '9') a =40+s[x-1]-'0';
			if(s[x-1] >= 'A' && s[x-1] <= 'Z') a =60+s[x-1]-'A';
			h1 =(h1*999983+a)%1000000009;
			h2 =(h2*4521+a+2)%1000000007;
			int z =x+y;
			x =y;
			y =z;}
		S[l].insert(make_pair(h1,h2));}
	int ans =0;
	for(int i =0; i <= 1000; i++) ans +=S[i].size();
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing
