Codeforces-SolutionsA/Codes/4C Registration System/4C.cpp
2023-12-15 13:06:05 +06:00

39 lines
619 B
C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
unordered_map<string,int>m;
for(int i=0; i<n; ++i)
{
string s;
cin>>s;
auto it= m.find(s);
if(it==m.end())
{
m[s];
cout<<"OK"<<endl;
}
else
{
m[s]++;
s=s+to_string(m[s]);
m[s];
cout<<s<<endl;
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
//cin >> TC;
//cin.ignore();
while (TC--) solve();
}