#include<bits/stdc++.h>
using namespace std;
int a[10005];
string turn (long long x)
{
stack<char>a;
while(x)
{
a.push((char)('0'+x%10));
x/=10;
}
string y="";
while(a.size())
{
y=y+a.top();
a.pop();
}
return y;
}
int main()
{
int t;cin>>t;
set<string>x;
while(t--)
{
string y;
cin>>y;
int size1=x.size();
x.insert(y);
int size2=x.size();
if(size1==size2)//字符串已经有了
{
int q=0;
while(size1==size2&&++q)
{
size1=x.size();
x.insert(y+turn(q));
size2=x.size();
}cout<<y+turn(q)<<endl;
}
else
{
cout<<"OK"<<endl;
}
}
}
nyoj991
最新推荐文章于 2018-07-24 19:59:00 发布