You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
409 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
string str;
map<string, int> m;
cin >> n;
for (i = 1; i <= n; ++i) {
cin >> str;
if (m.count(str) > 0) {
m[str]++;
cout << str << m[str] << endl;
} else {
m[str] = 1;
cout << "OK" << endl;
}
}
return 0;
}