#include<bits/stdc++.h> usingnamespace std; constint LEN = 27; string str; int ans, c[LEN][LEN];
voidinit(){ for (int i = 0; i < LEN; ++i) { c[i][0] = c[i][i] = 1; for (int j = 1; j < i; ++j) { c[i][j] = c[i - 1][j] + c[i - 1][j - 1]; } } }
booljudge(){ int len = str.length(); if (len < 1 || len > 6) returnfalse; for (int i = 0; i < len - 1; ++i) { if (str[i] >= str[i + 1]) returnfalse; } returntrue; }
intmain(){ init(); cin >> str; if (!judge()) { cout << 0; return0; } for (int i = 1, len = str.length(); i < len; ++i) ans += c[26][i]; for (int pre = 96, i = 0, len = str.length(); i < len; ++i) { for (int j = pre + 1; j < str[i]; ++j) { ans += c[26 - (j - 'a' + 1)][len - (i + 1)]; } pre = str[i]; } cout << ans + 1; return0; }