天天看點

CodeForces 4C

#include <iostream>
#include <string>
#include <map>
using namespace std;

int n;

int main()
{
    string str;
    map<string,int> q;
    cin >> n;
    for(int i = 1;i <= n;i ++)
    {
        cin >> str;
        if(q[str] > 0)
        {
            cout << str << q[str] << endl;
            q[str] ++;
        }
        else
        {
            cout << "OK" << endl;
            q[str] = 1;
        }
    }
    return 0;
}