/// Trie (normal)...
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 5000050
struct Trie
{
ll nextt[maxn][26];
ll endmark[maxn];
ll sz;
Trie()
{
clear();
}
void clear()
{
sz=0;
memset(nextt[0],-1,sizeof(nextt[0]));
memset(endmark,0,sizeof endmark);
}
void add(const char* str)
{
ll v=0;
ll len=strlen(str);
for(ll i = 0; i< len; ++i)
{
int id = str[i] - 'a';
if(nextt[v][id] == -1)
{
nextt[v][id]=++sz;
memset(nextt[sz],-1,sizeof(nextt[sz]));
}
v=nextt[v][id];
}
endmark[v]++;
}
ll dfs(const char* s)
{
ll v=0;
ll len=strlen(s);
for(ll i=0; i<len ; i++)
{
ll id=s[i]-'a';
if(nextt[v][id]==-1)
{
return 0;
}
v=nextt[v][id];
}
return endmark[v];
}
};
Trie tree;
char s[100005];
int main()
{
tree.clear();
scanf(" %s",s);
tree.add(s);
tree.add(s);
cout<<tree.dfs(s)<<endl;
return 0;
}
Ci8vLyBUcmllIChub3JtYWwpLi4uCgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBtYXhuIDUwMDAwNTAKCnN0cnVjdCBUcmllCnsKICAgIGxsIG5leHR0W21heG5dWzI2XTsKICAgIGxsIGVuZG1hcmtbbWF4bl07CiAgICBsbCBzejsKICAgIFRyaWUoKQogICAgewogICAgICAgIGNsZWFyKCk7CiAgICB9CiAgICB2b2lkIGNsZWFyKCkKICAgIHsKICAgICAgICBzej0wOwogICAgICAgIG1lbXNldChuZXh0dFswXSwtMSxzaXplb2YobmV4dHRbMF0pKTsKICAgICAgICBtZW1zZXQoZW5kbWFyaywwLHNpemVvZiBlbmRtYXJrKTsKICAgIH0KICAgIHZvaWQgYWRkKGNvbnN0IGNoYXIqIHN0cikKICAgIHsKICAgICAgICBsbCB2PTA7CiAgICAgICAgbGwgbGVuPXN0cmxlbihzdHIpOwogICAgICAgIGZvcihsbCBpID0gMDsgaTwgbGVuOyArK2kpCiAgICAgICAgewogICAgICAgICAgICBpbnQgaWQgPSBzdHJbaV0gLSAnYSc7CiAgICAgICAgICAgIGlmKG5leHR0W3ZdW2lkXSA9PSAtMSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbmV4dHRbdl1baWRdPSsrc3o7CiAgICAgICAgICAgICAgICBtZW1zZXQobmV4dHRbc3pdLC0xLHNpemVvZihuZXh0dFtzel0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2PW5leHR0W3ZdW2lkXTsKICAgICAgICB9CiAgICAgICAgZW5kbWFya1t2XSsrOwogICAgfQogICAgbGwgZGZzKGNvbnN0IGNoYXIqIHMpCiAgICB7CiAgICAgICAgbGwgdj0wOwogICAgICAgIGxsIGxlbj1zdHJsZW4ocyk7CiAgICAgICAgZm9yKGxsIGk9MDsgaTxsZW4gOyBpKyspCiAgICAgICAgewogICAgICAgICAgICBsbCBpZD1zW2ldLSdhJzsKICAgICAgICAgICAgaWYobmV4dHRbdl1baWRdPT0tMSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdj1uZXh0dFt2XVtpZF07CiAgICAgICAgfQogICAgICAgIHJldHVybiBlbmRtYXJrW3ZdOwogICAgfQp9OwpUcmllIHRyZWU7CgpjaGFyIHNbMTAwMDA1XTsKaW50IG1haW4oKQp7CiAgICB0cmVlLmNsZWFyKCk7CiAgICBzY2FuZigiICVzIixzKTsKICAgIHRyZWUuYWRkKHMpOwogICAgdHJlZS5hZGQocyk7CiAgICBjb3V0PDx0cmVlLmRmcyhzKTw8ZW5kbDsKICAgIHJldHVybiAwOwp9Cg==