#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<map>
#include<queue>
#include<stack>
typedef long long LL;
using namespace std;
char a[
100];
int main()
{
int b;
stack<LL> Q;
while (
cin >> a >> b)
{
LL ans =
0;
for (
int i=
0;a[i];i++)
{
ans *=
26;
ans += (a[i] -
'a');
}
while (ans)
{
Q.push(ans%b);
ans /= b;
}
int f =
0;
while (!Q.empty())
{
f =
1;
int s = Q.top();
Q.pop();
cout << s;
}
if (!f)
{
puts(
"0");
}
else
{
puts(
"");
}
}
return 0;
}
转载请注明原文地址: https://www.6miu.com/read-20608.html