#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char str[100005][40];
int fig[100005];
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
memset(fig,0,sizeof(fig));
for(int i=0;i<n;i++)
{
scanf("%s",str[i]);
int k=0;
int index=0;
for(int j=0;j<i;j++)
{
if(strcmp(str[i],str[j])==0)
{
k=++fig[j];
index=j;
break;
}
}
if(k==0)
printf("OK\n");
else
printf("%s%d\n",str[i],fig[index]);
}
}
return 0;
}
/*
4
abacaba
acaba
abacaba
acab
6
first
first
second
second
third
third
*/
http://codeforces.com/problemset/problem/4/C
最新推荐文章于 2022-08-23 07:44:44 发布