#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <stack>
#include <bitset>
//#include <unordered_set>
#define mkp make_pair
#define err cout<<"here"<<endl
using namespace std;
const double EPS=1e-12;
typedef long long lon;
typedef unsigned long long ull;
typedef map<ull,int>::iterator IT;
const lon SZ=12,SSZ=10,APB=128,m2=200003,mod=9901,one=97;
const lon INF=0x7FFFFFFF;
int n,dp['z'+1][SZ];
struct nd{
int to,wt;
nd(int a=0,int b=0):to(a),wt(b){}
};
char ch[SZ];
int dfs(int pos,char pre,int lim)
{
if(!lim&&dp[pre][pos]!=-1)return dp[pre][pos];
if(pos==n+1)
{
return pre!='a'-1;
}
int up=lim?ch[pos]:'z',res=0;
for(int i=pre=='a'-1?'a'-1:pre+1;i<=up;++i)
{
res+=dfs(pos+1,i,lim&&i==ch[pos]);
}
if(!lim)dp[pre][pos]=res;
return res;
}
void init()
{
cin>>ch+1;
memset(dp,-1,sizeof(dp));
n=strlen(ch+1);
for(int i=1;ch[i];++i)
{
if(ch[i]<=ch[i-1])
{
cout<<0<<endl;
return;
}
}
int res=dfs(1,'a'-1,1);
cout<<res<<endl;
}
void work()
{
}
void release()
{
}
int main()
{
std::ios::sync_with_stdio(0);
//freopen("d:\\1.txt","r",stdin);
lon casenum;
//cin>>casenum;
//cout<<casenum<<endl;
//for(lon time=1;time<=casenum;++time)
//for(lon time=1;cin>>n;++time)
{
init();
work();
release();
}
return 0;
}