/***User register using name, if not exist in DB, add to db and return ok,
if already exist new user name to be created using rule least i is appended and prompted back to user
#user i/p will be n (number of registration requests) and o/p will be ok/newname***/
#include <iostream>
#include <vector>
#include <map>
#include <sstream>
using namespace std;
vector<string> vDB;
map<string, int> nameFrequency;
string processRegistrationRequest(string name)
{
if(nameFrequency[name] == 0)
{
vDB.push_back(name);
nameFrequency[name]++;
return "ok";
}
else
{
stringstream str;
str<<name<<nameFrequency[name];
vDB.push_back(str.str());
nameFrequency[name]++;
return str.str();
}
}
int main() {
int numberOfRequests = 0;
cin >> numberOfRequests;
string name;
for(int i=0; i<numberOfRequests; i++)
{
cin >> name;
cout<< processRegistrationRequest(name) <<endl;
}
cout<<"DB"<<endl;
for(auto x: vDB)
cout<<x<<endl;
return 0;
}