#include<iostream>
using namespace std;
#include<algorithm>
#include<string>
int main()
{
string str;
cin >> str;
long long ans = 1;
string s = "a";
while (s != str)
{
ans++;
int l = s.length();
s[l - 1] = char(s[l - 1]++);
for (int i = l - 1;i >= 0;i--)
{
int k = int(s[i] - 96);
if (k > 26 - l + i + 1)
{
if (i == 0)
{
s.resize(l + 1);
int c = 1;
for (int j = 0;j<=s.size();j++)
{
s[j] = char(96 +c);
c++;
}
}
else
{
s[i - 1] = char(s[i - 1] + 1);
s[i] = char(int(s[i-1])+1);
}
}
}
//cout << s << endl;
}
cout << ans << endl;
return 0;
}
#include<iostream>
using namespace std;
int n;
int const N = 100000 + 10;
int f[N * 10];
int arr[N];
int main()
{
cin >> n;
for (int i = 1;i <= n;i++)
{
cin >> arr[i];
int flag = arr[i];
while (flag <= 1000000)
{
f[flag]++;
flag += arr[i];
}
}
for (int i = 1;i <= n;i++)
{
cout << f[arr[i]]-1 << endl;
}
return 0;
}
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
int const N = 100000 + 10;
int f[N * 10];
int arr[N];
int main()
{
cin >> n;
for (int i = 1;i <= n;i++)
{
cin >> arr[i];
f[arr[i]]++;
}
for (int i = 1;i <= n;i++)
{
int ans = 0;
f[arr[i]]--;
for (int j = 1;j <= sqrt(arr[i]);j++)
{
if (arr[i] % j == 0)
{
ans += f[j] ;
ans += f[arr[i] / j];
if (j ==arr[i]/j)
{
ans -= f[j];
}
}
}
f[arr[i]]++;
cout << ans << endl;
}
return 0;
}
#include<iostream>
using namespace std;
int l, r;
bool vis[1000010];
bool f(int x)
{
for (int i = 2;i * i <= x;i++)
{
if (x % i == 0)return false;
}
return true;
}
int main()
{
cin >> l >> r;
int ans = 0;
int n = r - l + 1;
for (int i = 1;i <= n;i++)
{
int flag = l + i - 1;
if (flag == 1)
{
vis[i] = 1;
}
else if (!vis[i])
{
if (f(flag))
{
ans++;
}
vis[i] = 1;
int x = 2 * flag;
while (x <= r)
{
vis[flag - l + 1] = true;
x += flag;
}
}
}
cout << ans << endl;
return 0;
}
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int l, n;
cin >> l >> n;
int minn = 0;
int maxx = 0;
for (int i = 1;i <= n;i++)
{
int x;
cin >> x;
int xiao = min(x, l - x + 1);
int da = max(x, l - x + 1);
minn = max(xiao, minn);
maxx = max(maxx, da);
}
cout << minn << " " << maxx << endl;
return 0;
}