#include<bits/stdc++.h>
using namespace std;
int cnt = 1;
string s;
map<string, int> mp;
void solve()
{
char i, j, k, l, n;
for(i='a';i<='z';i++)
{
s = i;
mp[s] = cnt++;
}
for(i='a';i<='y';i++)
{
for(j=i+1;j<='z';j++)
{
s = i, s = s+j;
mp[s] = cnt++;
}
}
for(i='a';i<='x';i++)
{
for(j=i+1;j<='y';j++)
{
for(k=j+1;k<='z';k++)
{
s = i, s = s + j, s = s + k;
mp[s] = cnt++;
}
}
}
for(i='a';i<='w';i++)
{
for(j=i+1;j<='x';j++)
{
for(k=j+1;k<='y';k++)
{
for(l=k+1;l<='z';l++)
{
s = i, s = s + j, s = s + k, s = s + l;
mp[s] = cnt++;
}
}
}
}
for(i='a';i<='v';i++)
{
for(j=i+1;j<='w';j++)
{
for(k=j+1;k<='x';k++)
{
for(l=k+1;l<='y';l++)
{
for(n=l+1;n<='z';n++)
{
s = i, s = s+j, s = s+k, s = s+l, s = s+n;
mp[s] = cnt++;
}
}
}
}
}
}
int main()
{
solve();
string st;
while(cin >> st)
{
cout << mp[st] << "\n";
}
return 0;
}
using namespace std;
int cnt = 1;
string s;
map<string, int> mp;
void solve()
{
char i, j, k, l, n;
for(i='a';i<='z';i++)
{
s = i;
mp[s] = cnt++;
}
for(i='a';i<='y';i++)
{
for(j=i+1;j<='z';j++)
{
s = i, s = s+j;
mp[s] = cnt++;
}
}
for(i='a';i<='x';i++)
{
for(j=i+1;j<='y';j++)
{
for(k=j+1;k<='z';k++)
{
s = i, s = s + j, s = s + k;
mp[s] = cnt++;
}
}
}
for(i='a';i<='w';i++)
{
for(j=i+1;j<='x';j++)
{
for(k=j+1;k<='y';k++)
{
for(l=k+1;l<='z';l++)
{
s = i, s = s + j, s = s + k, s = s + l;
mp[s] = cnt++;
}
}
}
}
for(i='a';i<='v';i++)
{
for(j=i+1;j<='w';j++)
{
for(k=j+1;k<='x';k++)
{
for(l=k+1;l<='y';l++)
{
for(n=l+1;n<='z';n++)
{
s = i, s = s+j, s = s+k, s = s+l, s = s+n;
mp[s] = cnt++;
}
}
}
}
}
}
int main()
{
solve();
string st;
while(cin >> st)
{
cout << mp[st] << "\n";
}
return 0;
}
Comments
Post a Comment