#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<sstream>
#include<limits.h>
#include<iomanip>
#include<cstring>
#include<bitset>
#include<fstream>
#include<cmath>
#include<cassert>
#include <stdio.h>
#include<ctype.h>
using namespace std;
vector <int> ZFunction(string &str) {
vector <int> Z(str.size(), 0);
int L = 0, R = 0;
for(int i = 1; i < str.size(); ++ i) {
if (i > R || Z[i - L] >= R - i + 1) {
L = i; R = max(i, R);
while (R < str.size() && str[R - L] == str[R]) R ++;
Z[i] = (R --) - L;
} else
Z[i] = Z[i - L];
}
Z[0] = str.size();
return Z;
}
int thirdPattern(vector<int> &Z) {
int res = 0;
for(int i = 1; i < Z.size(); ++ i)
if(Z[i] >= i && i * 2 < Z.size())
res ++;
return res;
}
int secondPattern(vector<int> &Z) {
int res = 0;
for(int i = 1; i < Z.size(); ++ i)
if(Z[i] + i == Z.size() && Z[i] * 2 < Z.size())
res ++;
return res;
}
int main() {
// freopen("input.txt","r",stdin);
string str, rev;
while(cin >> str) {
rev = str;
reverse(rev.begin(), rev.end());
vector<int> Z = ZFunction(str);
vector<int> Z_rev = ZFunction(rev);
int res = thirdPattern(Z_rev);
res += secondPattern(Z);
res += thirdPattern(Z);
cout << res << endl;
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHN0cmluZz4KI2luY2x1ZGU8bWFwPgojaW5jbHVkZTx2ZWN0b3I+CiNpbmNsdWRlPHF1ZXVlPgojaW5jbHVkZTxzdGFjaz4KI2luY2x1ZGU8c2V0PgojaW5jbHVkZTxhbGdvcml0aG0+CiNpbmNsdWRlPHNzdHJlYW0+CiNpbmNsdWRlPGxpbWl0cy5oPgojaW5jbHVkZTxpb21hbmlwPgojaW5jbHVkZTxjc3RyaW5nPgojaW5jbHVkZTxiaXRzZXQ+CiNpbmNsdWRlPGZzdHJlYW0+CiNpbmNsdWRlPGNtYXRoPgojaW5jbHVkZTxjYXNzZXJ0PgojaW5jb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