#include<bits/stdc++.h>
using namespace std;
char s[10];
int a[10],r[10];
int sum,ans,ls,lr,t;
bool pd()
{
for(int i=0; i<6; i++)
if(a[i]!=r[i])
return false;
return true;
}
int main()
{
//freopen("slyar.in","r",stdin);
//freopen("slyar.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
cin>>s;
ls=strlen(s);
if(ls>6)
{
cout<<0;
return 0;
}
for(int i=0; i<ls; i++)
a[i]=s[ls-i-1]-'a'+1;
for(int i=0; i<ls-1; i++)
if(a[i]<a[i+1]||!(a[i]>=1&&a[i]<=26&&a[i+1]>=1&&a[i+1]<=26))
{
cout<<0;
return 0;
}
int x=0;
while(1)
{
t=0;
r[0]++;
ans++;
while(r[t]>26-t)
{
if(r[lr]>26-lr)
{
for(int i=0; i<=lr+1; i++)
r[i]=lr-i+2;
lr++;
break;
}
r[t+1]++;
for(int i=0; i<=t; i++)
r[i]=r[t+1]+t-i+1;
t++;
}
if(pd())
{
cout<<ans;
return 0;
}
//cout<<ans<<' ';
//for(int i=0;i<=lr;i++)
//cout<<r[i]<<' ';
//cout<<"\n";
}
//fclose(stdin);
//fclose(stdout);
return 0;
}